@activecollab/components 2.0.506 → 2.0.507
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/components/ObjectFormModal/ObjectFormModal.js +117 -0
- package/dist/cjs/components/ObjectFormModal/ObjectFormModal.js.map +1 -0
- package/dist/cjs/components/ObjectFormModal/Styles.js +28 -0
- package/dist/cjs/components/ObjectFormModal/Styles.js.map +1 -0
- package/dist/cjs/components/ObjectFormModal/index.js +17 -0
- package/dist/cjs/components/ObjectFormModal/index.js.map +1 -0
- package/dist/cjs/components/PropertyList/PropertyList.js +27 -7
- package/dist/cjs/components/PropertyList/PropertyList.js.map +1 -1
- package/dist/cjs/components/PropertyList/Styles.js +38 -29
- package/dist/cjs/components/PropertyList/Styles.js.map +1 -1
- package/dist/cjs/components/index.js +11 -0
- package/dist/cjs/components/index.js.map +1 -1
- package/dist/cjs/hooks/useInputHours.js +6 -1
- package/dist/cjs/hooks/useInputHours.js.map +1 -1
- package/dist/cjs/hooks/useInputNumber.js +6 -1
- package/dist/cjs/hooks/useInputNumber.js.map +1 -1
- package/dist/esm/components/ObjectFormModal/ObjectFormModal.d.ts +24 -0
- package/dist/esm/components/ObjectFormModal/ObjectFormModal.d.ts.map +1 -0
- package/dist/esm/components/ObjectFormModal/ObjectFormModal.js +101 -0
- package/dist/esm/components/ObjectFormModal/ObjectFormModal.js.map +1 -0
- package/dist/esm/components/ObjectFormModal/Styles.d.ts +7 -0
- package/dist/esm/components/ObjectFormModal/Styles.d.ts.map +1 -0
- package/dist/esm/components/ObjectFormModal/Styles.js +15 -0
- package/dist/esm/components/ObjectFormModal/Styles.js.map +1 -0
- package/dist/esm/components/ObjectFormModal/index.d.ts +2 -0
- package/dist/esm/components/ObjectFormModal/index.d.ts.map +1 -0
- package/dist/esm/components/ObjectFormModal/index.js +2 -0
- package/dist/esm/components/ObjectFormModal/index.js.map +1 -0
- package/dist/esm/components/PropertyList/PropertyList.d.ts +5 -0
- package/dist/esm/components/PropertyList/PropertyList.d.ts.map +1 -1
- package/dist/esm/components/PropertyList/PropertyList.js +24 -6
- package/dist/esm/components/PropertyList/PropertyList.js.map +1 -1
- package/dist/esm/components/PropertyList/Styles.d.ts +4 -1
- package/dist/esm/components/PropertyList/Styles.d.ts.map +1 -1
- package/dist/esm/components/PropertyList/Styles.js +38 -29
- package/dist/esm/components/PropertyList/Styles.js.map +1 -1
- package/dist/esm/components/index.d.ts +1 -0
- package/dist/esm/components/index.d.ts.map +1 -1
- package/dist/esm/components/index.js +1 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/hooks/useInputHours.d.ts.map +1 -1
- package/dist/esm/hooks/useInputHours.js +6 -1
- package/dist/esm/hooks/useInputHours.js.map +1 -1
- package/dist/esm/hooks/useInputNumber.d.ts.map +1 -1
- package/dist/esm/hooks/useInputNumber.js +6 -1
- package/dist/esm/hooks/useInputNumber.js.map +1 -1
- package/dist/index.js +948 -799
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React, { HTMLAttributes } from "react";
|
|
2
|
+
import { DialogSize } from "../Dialog/Styles";
|
|
3
|
+
export interface ObjectFormModalProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
open?: boolean;
|
|
5
|
+
onClose?: () => void;
|
|
6
|
+
/** Accessible name of the modal, for example "New Event". The modal draws no title. */
|
|
7
|
+
label: string;
|
|
8
|
+
/** Width step, the same scale as Dialog. Every step is a max-width. */
|
|
9
|
+
size?: DialogSize;
|
|
10
|
+
/** A click outside keeps the modal open by default, so a form with text in it never closes by accident. */
|
|
11
|
+
enableBackgroundClick?: boolean;
|
|
12
|
+
disableCloseOnEsc?: boolean;
|
|
13
|
+
disableFocusLock?: boolean;
|
|
14
|
+
/** The surface becomes a column, so one part of the content can scroll in place of the modal. */
|
|
15
|
+
fill?: boolean;
|
|
16
|
+
/** A close button beside the top right corner. It turns `fill` on. */
|
|
17
|
+
closeButton?: boolean;
|
|
18
|
+
closeLabel?: string;
|
|
19
|
+
className?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare const ObjectFormModal: React.ForwardRefExoticComponent<ObjectFormModalProps & {
|
|
22
|
+
children?: React.ReactNode | undefined;
|
|
23
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
24
|
+
//# sourceMappingURL=ObjectFormModal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObjectFormModal.d.ts","sourceRoot":"","sources":["../../../../src/components/ObjectFormModal/ObjectFormModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAEZ,cAAc,EAKf,MAAM,OAAO,CAAC;AAOf,OAAO,EACL,UAAU,EAGX,MAAM,kBAAkB,CAAC;AAU1B,MAAM,WAAW,oBAAqB,SAAQ,cAAc,CAAC,cAAc,CAAC;IAC1E,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,uFAAuF;IACvF,KAAK,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,2GAA2G;IAC3G,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,iGAAiG;IACjG,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,sEAAsE;IACtE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA4BD,eAAO,MAAM,eAAe;;wCAiF3B,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["children", "open", "onClose", "label", "size", "enableBackgroundClick", "disableCloseOnEsc", "disableFocusLock", "fill", "closeButton", "closeLabel", "className"];
|
|
4
|
+
import React, { forwardRef, useCallback, useState } from "react";
|
|
5
|
+
import classnames from "classnames";
|
|
6
|
+
import { StyledObjectFormModal, StyledObjectFormModalClose } from "./Styles";
|
|
7
|
+
import { LayerContextProvider } from "../../helpers";
|
|
8
|
+
import { layers } from "../../utils";
|
|
9
|
+
import { dialogSizes, StyledDialogViewport } from "../Dialog/Styles";
|
|
10
|
+
import { useFluidHeightAnimation } from "../Dialog/useFluidHeightAnimation";
|
|
11
|
+
import { CancelCrossIcon } from "../Icons";
|
|
12
|
+
import { Modal } from "../Modal";
|
|
13
|
+
import { SlideFromTop, SLIDE_FROM_TOP_ENTER, SLIDE_FROM_TOP_EXIT } from "../Transitions/SlideFromTop";
|
|
14
|
+
// A sheet puts its content on a lower layer. The form modal always covers the page, the menu and the sheet.
|
|
15
|
+
const MODAL_LAYER = {
|
|
16
|
+
zIndex: layers.skyscraper
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
// Modal only treats a child as a transition when its props already carry `in`.
|
|
20
|
+
const ObjectFormModalSurface = _ref => {
|
|
21
|
+
let _ref$in = _ref.in,
|
|
22
|
+
inProp = _ref$in === void 0 ? false : _ref$in,
|
|
23
|
+
onEnter = _ref.onEnter,
|
|
24
|
+
onExited = _ref.onExited,
|
|
25
|
+
children = _ref.children;
|
|
26
|
+
return /*#__PURE__*/React.createElement(StyledDialogViewport, {
|
|
27
|
+
className: "c-object-form-modal-viewport"
|
|
28
|
+
}, /*#__PURE__*/React.createElement(SlideFromTop, {
|
|
29
|
+
in: inProp,
|
|
30
|
+
onEnter: onEnter,
|
|
31
|
+
onExited: onExited
|
|
32
|
+
}, children));
|
|
33
|
+
};
|
|
34
|
+
ObjectFormModalSurface.displayName = "ObjectFormModalSurface";
|
|
35
|
+
export const ObjectFormModal = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
36
|
+
var _dialogSizes$size;
|
|
37
|
+
let children = _ref2.children,
|
|
38
|
+
_ref2$open = _ref2.open,
|
|
39
|
+
open = _ref2$open === void 0 ? false : _ref2$open,
|
|
40
|
+
onClose = _ref2.onClose,
|
|
41
|
+
label = _ref2.label,
|
|
42
|
+
_ref2$size = _ref2.size,
|
|
43
|
+
size = _ref2$size === void 0 ? "s" : _ref2$size,
|
|
44
|
+
_ref2$enableBackgroun = _ref2.enableBackgroundClick,
|
|
45
|
+
enableBackgroundClick = _ref2$enableBackgroun === void 0 ? false : _ref2$enableBackgroun,
|
|
46
|
+
_ref2$disableCloseOnE = _ref2.disableCloseOnEsc,
|
|
47
|
+
disableCloseOnEsc = _ref2$disableCloseOnE === void 0 ? false : _ref2$disableCloseOnE,
|
|
48
|
+
_ref2$disableFocusLoc = _ref2.disableFocusLock,
|
|
49
|
+
disableFocusLock = _ref2$disableFocusLoc === void 0 ? false : _ref2$disableFocusLoc,
|
|
50
|
+
_ref2$fill = _ref2.fill,
|
|
51
|
+
fill = _ref2$fill === void 0 ? false : _ref2$fill,
|
|
52
|
+
_ref2$closeButton = _ref2.closeButton,
|
|
53
|
+
closeButton = _ref2$closeButton === void 0 ? false : _ref2$closeButton,
|
|
54
|
+
_ref2$closeLabel = _ref2.closeLabel,
|
|
55
|
+
closeLabel = _ref2$closeLabel === void 0 ? "Close" : _ref2$closeLabel,
|
|
56
|
+
className = _ref2.className,
|
|
57
|
+
rest = _objectWithoutPropertiesLoose(_ref2, _excluded);
|
|
58
|
+
const _useState = useState(null),
|
|
59
|
+
surfaceNode = _useState[0],
|
|
60
|
+
setSurfaceNode = _useState[1];
|
|
61
|
+
const setSurface = useCallback(node => {
|
|
62
|
+
setSurfaceNode(node);
|
|
63
|
+
if (typeof ref === "function") {
|
|
64
|
+
ref(node);
|
|
65
|
+
} else if (ref) {
|
|
66
|
+
ref.current = node;
|
|
67
|
+
}
|
|
68
|
+
}, [ref]);
|
|
69
|
+
useFluidHeightAnimation(surfaceNode, true);
|
|
70
|
+
return /*#__PURE__*/React.createElement(LayerContextProvider, {
|
|
71
|
+
value: MODAL_LAYER
|
|
72
|
+
}, /*#__PURE__*/React.createElement(Modal, {
|
|
73
|
+
open: open,
|
|
74
|
+
onClose: onClose,
|
|
75
|
+
disableBackgroundClick: !enableBackgroundClick,
|
|
76
|
+
disableCloseOnEsc: disableCloseOnEsc,
|
|
77
|
+
disableFocusLock: disableFocusLock,
|
|
78
|
+
overlayTimeout: {
|
|
79
|
+
enter: SLIDE_FROM_TOP_ENTER,
|
|
80
|
+
exit: SLIDE_FROM_TOP_EXIT
|
|
81
|
+
}
|
|
82
|
+
}, /*#__PURE__*/React.createElement(ObjectFormModalSurface, {
|
|
83
|
+
in: open
|
|
84
|
+
}, /*#__PURE__*/React.createElement(StyledObjectFormModal, _extends({}, rest, {
|
|
85
|
+
ref: setSurface,
|
|
86
|
+
role: "dialog",
|
|
87
|
+
"aria-modal": "true",
|
|
88
|
+
"aria-label": label,
|
|
89
|
+
$maxWidth: (_dialogSizes$size = dialogSizes[size]) != null ? _dialogSizes$size : dialogSizes.s,
|
|
90
|
+
$fill: fill || closeButton,
|
|
91
|
+
$closeButton: closeButton,
|
|
92
|
+
className: classnames("c-object-form-modal", className)
|
|
93
|
+
}), closeButton ? /*#__PURE__*/React.createElement(StyledObjectFormModalClose, {
|
|
94
|
+
type: "button",
|
|
95
|
+
className: "c-object-form-modal-close",
|
|
96
|
+
"aria-label": closeLabel,
|
|
97
|
+
onClick: onClose
|
|
98
|
+
}, /*#__PURE__*/React.createElement(CancelCrossIcon, null)) : null, children))));
|
|
99
|
+
});
|
|
100
|
+
ObjectFormModal.displayName = "ObjectFormModal";
|
|
101
|
+
//# sourceMappingURL=ObjectFormModal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObjectFormModal.js","names":["React","forwardRef","useCallback","useState","classnames","StyledObjectFormModal","StyledObjectFormModalClose","LayerContextProvider","layers","dialogSizes","StyledDialogViewport","useFluidHeightAnimation","CancelCrossIcon","Modal","SlideFromTop","SLIDE_FROM_TOP_ENTER","SLIDE_FROM_TOP_EXIT","MODAL_LAYER","zIndex","skyscraper","ObjectFormModalSurface","_ref","_ref$in","in","inProp","onEnter","onExited","children","createElement","className","displayName","ObjectFormModal","_ref2","ref","_dialogSizes$size","_ref2$open","open","onClose","label","_ref2$size","size","_ref2$enableBackgroun","enableBackgroundClick","_ref2$disableCloseOnE","disableCloseOnEsc","_ref2$disableFocusLoc","disableFocusLock","_ref2$fill","fill","_ref2$closeButton","closeButton","_ref2$closeLabel","closeLabel","rest","_objectWithoutPropertiesLoose","_excluded","_useState","surfaceNode","setSurfaceNode","setSurface","node","current","value","disableBackgroundClick","overlayTimeout","enter","exit","_extends","role","$maxWidth","s","$fill","$closeButton","type","onClick"],"sources":["../../../../src/components/ObjectFormModal/ObjectFormModal.tsx"],"sourcesContent":["import React, {\n forwardRef,\n HTMLAttributes,\n PropsWithChildren,\n ReactElement,\n useCallback,\n useState,\n} from \"react\";\n\nimport classnames from \"classnames\";\n\nimport { StyledObjectFormModal, StyledObjectFormModalClose } from \"./Styles\";\nimport { LayerContextProvider } from \"../../helpers\";\nimport { layers } from \"../../utils\";\nimport {\n DialogSize,\n dialogSizes,\n StyledDialogViewport,\n} from \"../Dialog/Styles\";\nimport { useFluidHeightAnimation } from \"../Dialog/useFluidHeightAnimation\";\nimport { CancelCrossIcon } from \"../Icons\";\nimport { Modal } from \"../Modal\";\nimport {\n SlideFromTop,\n SLIDE_FROM_TOP_ENTER,\n SLIDE_FROM_TOP_EXIT,\n} from \"../Transitions/SlideFromTop\";\n\nexport interface ObjectFormModalProps extends HTMLAttributes<HTMLDivElement> {\n open?: boolean;\n onClose?: () => void;\n /** Accessible name of the modal, for example \"New Event\". The modal draws no title. */\n label: string;\n /** Width step, the same scale as Dialog. Every step is a max-width. */\n size?: DialogSize;\n /** A click outside keeps the modal open by default, so a form with text in it never closes by accident. */\n enableBackgroundClick?: boolean;\n disableCloseOnEsc?: boolean;\n disableFocusLock?: boolean;\n /** The surface becomes a column, so one part of the content can scroll in place of the modal. */\n fill?: boolean;\n /** A close button beside the top right corner. It turns `fill` on. */\n closeButton?: boolean;\n closeLabel?: string;\n className?: string;\n}\n\ninterface ObjectFormModalSurfaceProps {\n in?: boolean;\n onEnter?: () => void;\n onExited?: () => void;\n children: ReactElement;\n}\n\n// A sheet puts its content on a lower layer. The form modal always covers the page, the menu and the sheet.\nconst MODAL_LAYER = { zIndex: layers.skyscraper };\n\n// Modal only treats a child as a transition when its props already carry `in`.\nconst ObjectFormModalSurface = ({\n in: inProp = false,\n onEnter,\n onExited,\n children,\n}: ObjectFormModalSurfaceProps) => (\n <StyledDialogViewport className=\"c-object-form-modal-viewport\">\n <SlideFromTop in={inProp} onEnter={onEnter} onExited={onExited}>\n {children}\n </SlideFromTop>\n </StyledDialogViewport>\n);\n\nObjectFormModalSurface.displayName = \"ObjectFormModalSurface\";\n\nexport const ObjectFormModal = forwardRef<\n HTMLDivElement,\n PropsWithChildren<ObjectFormModalProps>\n>(\n (\n {\n children,\n open = false,\n onClose,\n label,\n size = \"s\",\n enableBackgroundClick = false,\n disableCloseOnEsc = false,\n disableFocusLock = false,\n fill = false,\n closeButton = false,\n closeLabel = \"Close\",\n className,\n ...rest\n },\n ref\n ) => {\n const [surfaceNode, setSurfaceNode] = useState<HTMLDivElement | null>(null);\n\n const setSurface = useCallback(\n (node: HTMLDivElement | null) => {\n setSurfaceNode(node);\n\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n },\n [ref]\n );\n\n useFluidHeightAnimation(surfaceNode, true);\n\n return (\n <LayerContextProvider value={MODAL_LAYER}>\n <Modal\n open={open}\n onClose={onClose}\n disableBackgroundClick={!enableBackgroundClick}\n disableCloseOnEsc={disableCloseOnEsc}\n disableFocusLock={disableFocusLock}\n overlayTimeout={{\n enter: SLIDE_FROM_TOP_ENTER,\n exit: SLIDE_FROM_TOP_EXIT,\n }}\n >\n <ObjectFormModalSurface in={open}>\n <StyledObjectFormModal\n {...rest}\n ref={setSurface}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={label}\n $maxWidth={dialogSizes[size] ?? dialogSizes.s}\n $fill={fill || closeButton}\n $closeButton={closeButton}\n className={classnames(\"c-object-form-modal\", className)}\n >\n {closeButton ? (\n <StyledObjectFormModalClose\n type=\"button\"\n className=\"c-object-form-modal-close\"\n aria-label={closeLabel}\n onClick={onClose}\n >\n <CancelCrossIcon />\n </StyledObjectFormModalClose>\n ) : null}\n {children}\n </StyledObjectFormModal>\n </ObjectFormModalSurface>\n </Modal>\n </LayerContextProvider>\n );\n }\n);\n\nObjectFormModal.displayName = \"ObjectFormModal\";\n"],"mappings":";;;AAAA,OAAOA,KAAK,IACVC,UAAU,EAIVC,WAAW,EACXC,QAAQ,QACH,OAAO;AAEd,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,qBAAqB,EAAEC,0BAA0B,QAAQ,UAAU;AAC5E,SAASC,oBAAoB,QAAQ,eAAe;AACpD,SAASC,MAAM,QAAQ,aAAa;AACpC,SAEEC,WAAW,EACXC,oBAAoB,QACf,kBAAkB;AACzB,SAASC,uBAAuB,QAAQ,mCAAmC;AAC3E,SAASC,eAAe,QAAQ,UAAU;AAC1C,SAASC,KAAK,QAAQ,UAAU;AAChC,SACEC,YAAY,EACZC,oBAAoB,EACpBC,mBAAmB,QACd,6BAA6B;AA4BpC;AACA,MAAMC,WAAW,GAAG;EAAEC,MAAM,EAAEV,MAAM,CAACW;AAAW,CAAC;;AAEjD;AACA,MAAMC,sBAAsB,GAAGC,IAAA;EAAA,IAAAC,OAAA,GAAAD,IAAA,CAC7BE,EAAE;IAAEC,MAAM,GAAAF,OAAA,cAAG,KAAK,GAAAA,OAAA;IAClBG,OAAO,GAAAJ,IAAA,CAAPI,OAAO;IACPC,QAAQ,GAAAL,IAAA,CAARK,QAAQ;I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SAAS,GAAAnC,iBAAA,GAAEzB,WAAW,CAAC+B,IAAI,CAAC,YAAAN,iBAAA,GAAIzB,WAAW,CAAC6D,CAAE;IAC9CC,KAAK,EAAEvB,IAAI,IAAIE,WAAY;IAC3BsB,YAAY,EAAEtB,WAAY;IAC1BrB,SAAS,EAAEzB,UAAU,CAAC,qBAAqB,EAAEyB,SAAS;EAAE,IAEvDqB,WAAW,gBACVlD,KAAA,CAAA4B,aAAA,CAACtB,0BAA0B;IACzBmE,IAAI,EAAC,QAAQ;IACb5C,SAAS,EAAC,2BAA2B;IACrC,cAAYuB,UAAW;IACvBsB,OAAO,EAAErC;EAAQ,gBAEjBrC,KAAA,CAAA4B,aAAA,CAAChB,eAAe,MAAE,CACQ,CAAC,GAC3B,IAAI,EACPe,QACoB,CACD,CACnB,CACa,CAAC;AAE3B,CACF,CAAC;AAEDI,eAAe,CAACD,WAAW,GAAG,iBAAiB","ignoreList":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const StyledObjectFormModalClose: import("styled-components").StyledComponent<"button", any, {}, never>;
|
|
2
|
+
export declare const StyledObjectFormModal: import("styled-components").StyledComponent<"div", any, {
|
|
3
|
+
$maxWidth: number;
|
|
4
|
+
$fill: boolean;
|
|
5
|
+
$closeButton: boolean;
|
|
6
|
+
}, never>;
|
|
7
|
+
//# sourceMappingURL=Styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Styles.d.ts","sourceRoot":"","sources":["../../../../src/components/ObjectFormModal/Styles.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,0BAA0B,uEAyBtC,CAAC;AAIF,eAAO,MAAM,qBAAqB;eACrB,MAAM;WACV,OAAO;kBACA,OAAO;SAgDtB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
|
+
import { BoxSizingStyle } from "../BoxSizingStyle";
|
|
3
|
+
import { FontStyle } from "../FontStyle";
|
|
4
|
+
const MAX_HEIGHT = "95vh";
|
|
5
|
+
export const StyledObjectFormModalClose = styled.button.withConfig({
|
|
6
|
+
displayName: "Styles__StyledObjectFormModalClose",
|
|
7
|
+
componentId: "sc-vysvjm-0"
|
|
8
|
+
})(["position:absolute;top:-1px;left:calc(100% + 8px);display:flex;align-items:center;justify-content:center;width:48px;height:48px;padding:0;cursor:pointer;background-color:var(--color-theme-200);border:1px solid var(--border-raised);box-shadow:var(--shadow-primary);border-radius:24px;&:hover{filter:brightness(1.1);}svg{width:24px;height:24px;fill:var(--color-theme-700);}"]);
|
|
9
|
+
StyledObjectFormModalClose.displayName = "StyledObjectFormModalClose";
|
|
10
|
+
export const StyledObjectFormModal = styled.div.withConfig({
|
|
11
|
+
displayName: "Styles__StyledObjectFormModal",
|
|
12
|
+
componentId: "sc-vysvjm-1"
|
|
13
|
+
})(["flex:0 0 auto;pointer-events:auto;position:relative;width:100%;max-width:", "px;max-height:", ";padding:20px;overflow-y:auto;overscroll-behavior:contain;background-color:var(--color-theme-200);color:var(--color-theme-900);border:1px solid var(--border-raised);box-shadow:var(--shadow-primary);border-radius:24px;&[data-resizing]{overflow:hidden;}", " ", " ", " ", ""], props => props.$maxWidth, MAX_HEIGHT, props => props.$fill && css(["display:flex;flex-direction:column;> :not(.c-object-form-modal-close){min-height:0;}"]), props => props.$closeButton && css(["&,&[data-resizing]{overflow:visible;}&[data-resizing] > :not(.c-object-form-modal-close){overflow:hidden;}"]), FontStyle, BoxSizingStyle);
|
|
14
|
+
StyledObjectFormModal.displayName = "StyledObjectFormModal";
|
|
15
|
+
//# sourceMappingURL=Styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Styles.js","names":["styled","css","BoxSizingStyle","FontStyle","MAX_HEIGHT","StyledObjectFormModalClose","button","withConfig","displayName","componentId","StyledObjectFormModal","div","props","$maxWidth","$fill","$closeButton"],"sources":["../../../../src/components/ObjectFormModal/Styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\n\nimport { BoxSizingStyle } from \"../BoxSizingStyle\";\nimport { FontStyle } from \"../FontStyle\";\n\nconst MAX_HEIGHT = \"95vh\";\n\nexport const StyledObjectFormModalClose = styled.button`\n position: absolute;\n top: -1px;\n left: calc(100% + 8px);\n display: flex;\n align-items: center;\n justify-content: center;\n width: 48px;\n height: 48px;\n padding: 0;\n cursor: pointer;\n background-color: var(--color-theme-200);\n border: 1px solid var(--border-raised);\n box-shadow: var(--shadow-primary);\n border-radius: 24px;\n\n &:hover {\n filter: brightness(1.1);\n }\n\n svg {\n width: 24px;\n height: 24px;\n fill: var(--color-theme-700);\n }\n`;\n\nStyledObjectFormModalClose.displayName = \"StyledObjectFormModalClose\";\n\nexport const StyledObjectFormModal = styled.div<{\n $maxWidth: number;\n $fill: boolean;\n $closeButton: boolean;\n}>`\n flex: 0 0 auto;\n pointer-events: auto;\n position: relative;\n width: 100%;\n max-width: ${(props) => props.$maxWidth}px;\n max-height: ${MAX_HEIGHT};\n padding: 20px;\n overflow-y: auto;\n overscroll-behavior: contain;\n background-color: var(--color-theme-200);\n color: var(--color-theme-900);\n border: 1px solid var(--border-raised);\n box-shadow: var(--shadow-primary);\n border-radius: 24px;\n\n &[data-resizing] {\n overflow: hidden;\n }\n\n ${(props) =>\n props.$fill &&\n css`\n display: flex;\n flex-direction: column;\n\n > :not(.c-object-form-modal-close) {\n min-height: 0;\n }\n `}\n\n /* The close button stands beside the surface, so the content clips in place of the surface. */\n ${(props) =>\n props.$closeButton &&\n css`\n &,\n &[data-resizing] {\n overflow: visible;\n }\n\n &[data-resizing] > :not(.c-object-form-modal-close) {\n overflow: hidden;\n }\n `}\n\n ${FontStyle}\n ${BoxSizingStyle}\n`;\n\nStyledObjectFormModal.displayName = \"StyledObjectFormModal\";\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAE/C,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,SAAS,QAAQ,cAAc;AAExC,MAAMC,UAAU,GAAG,MAAM;AAEzB,OAAO,MAAMC,0BAA0B,GAAGL,MAAM,CAACM,MAAM,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,0XAyBtD;AAEDJ,0BAA0B,CAACG,WAAW,GAAG,4BAA4B;AAErE,OAAO,MAAME,qBAAqB,GAAGV,MAAM,CAACW,GAAG,CAAAJ,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,sXAS/BG,KAAK,IAAKA,KAAK,CAACC,SAAS,EACzBT,UAAU,EAcrBQ,KAAK,IACNA,KAAK,CAACE,KAAK,IACXb,GAAG,0FAOF,EAGAW,KAAK,IACNA,KAAK,CAACG,YAAY,IAClBd,GAAG,gHASF,EAEDE,SAAS,EACTD,cAAc,CACjB;AAEDQ,qBAAqB,CAACF,WAAW,GAAG,uBAAuB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ObjectFormModal/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/ObjectFormModal/index.ts"],"sourcesContent":["export * from \"./ObjectFormModal\";\n"],"mappings":"AAAA,cAAc,mBAAmB","ignoreList":[]}
|
|
@@ -2,6 +2,7 @@ import React, { ButtonHTMLAttributes, HTMLAttributes, ReactNode } from "react";
|
|
|
2
2
|
import { PropertyListDensity, PropertyListLayoutName, PropertyListTone } from "./Styles";
|
|
3
3
|
export declare const usePropertyListDensity: () => PropertyListDensity;
|
|
4
4
|
export declare const usePropertyListLayout: () => PropertyListLayoutName;
|
|
5
|
+
export declare const usePropertyListDisabled: () => boolean;
|
|
5
6
|
/** Sets the layout of the rows below it: one line each, or the three columns of a table. */
|
|
6
7
|
export declare const PropertyListLayout: ({ value, children, }: {
|
|
7
8
|
value?: PropertyListLayoutName;
|
|
@@ -12,6 +13,8 @@ export declare const PropertyListDivider: () => React.JSX.Element;
|
|
|
12
13
|
export interface IPropertyListProps extends HTMLAttributes<HTMLDivElement> {
|
|
13
14
|
/** "form" for a compact list in a form, "page" for a list on a page, with a shadow. */
|
|
14
15
|
density?: PropertyListDensity;
|
|
16
|
+
/** Every row of the list is dimmed and takes no click and no focus. */
|
|
17
|
+
disabled?: boolean;
|
|
15
18
|
}
|
|
16
19
|
export declare const PropertyList: React.ForwardRefExoticComponent<IPropertyListProps & React.RefAttributes<HTMLDivElement>>;
|
|
17
20
|
export interface IPropertyListValueProps {
|
|
@@ -40,6 +43,8 @@ export interface IPropertyListRowProps extends Omit<HTMLAttributes<HTMLElement>,
|
|
|
40
43
|
/** A read only row is plain text. A row that can change is one button. */
|
|
41
44
|
readOnly?: boolean;
|
|
42
45
|
chevron?: boolean;
|
|
46
|
+
/** Dimmed, with no click and no focus. A disabled list disables its rows. */
|
|
47
|
+
disabled?: boolean;
|
|
43
48
|
/** Replaces the label, the value and the action. */
|
|
44
49
|
children?: ReactNode;
|
|
45
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyList.d.ts","sourceRoot":"","sources":["../../../../src/components/PropertyList/PropertyList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,oBAAoB,EAGpB,cAAc,EAEd,SAAS,EAKV,MAAM,OAAO,CAAC;AAIf,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,EAejB,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"PropertyList.d.ts","sourceRoot":"","sources":["../../../../src/components/PropertyList/PropertyList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,oBAAoB,EAGpB,cAAc,EAEd,SAAS,EAKV,MAAM,OAAO,CAAC;AAIf,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,EAejB,MAAM,UAAU,CAAC;AAOlB,eAAO,MAAM,sB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AAM,CAAC,EAAE,SAAS,CAAC;IACnB,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oDAAoD;IACpD,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,eAAO,MAAM,eAAe,2FAiE3B,CAAC;AAIF,MAAM,WAAW,wBACf,SAAQ,oBAAoB,CAAC,iBAAiB,CAAC;IAC/C,wDAAwD;IACxD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,0EAA0E;AAC1E,eAAO,MAAM,kBAAkB,oGAkB7B,CAAC;AAIH,MAAM,WAAW,wBACf,SAAQ,cAAc,CAAC,eAAe,CAAC;IACvC,iEAAiE;IACjE,QAAQ,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;CAC9B;AAED,kGAAkG;AAClG,eAAO,MAAM,kBAAkB,GAAI,uBAGhC,wBAAwB,sBAO1B,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["density", "className", "children"],
|
|
4
|
-
_excluded2 = ["icon", "label", "value", "action", "tone", "readOnly", "chevron", "className", "children"],
|
|
5
|
-
_excluded3 = ["expanded", "className", "children"],
|
|
3
|
+
const _excluded = ["density", "disabled", "className", "children"],
|
|
4
|
+
_excluded2 = ["icon", "label", "value", "action", "tone", "readOnly", "chevron", "disabled", "className", "children"],
|
|
5
|
+
_excluded3 = ["expanded", "disabled", "className", "children"],
|
|
6
6
|
_excluded4 = ["position"];
|
|
7
7
|
import React, { Children, Fragment, createContext, forwardRef, useContext } from "react";
|
|
8
8
|
import classnames from "classnames";
|
|
@@ -10,8 +10,10 @@ import { StyledPropertyList, StyledPropertyListAddIcon, StyledPropertyListBranch
|
|
|
10
10
|
import { AddCrossTinyIcon, ArrowDownSmallIcon } from "../Icons";
|
|
11
11
|
const DensityContext = /*#__PURE__*/createContext("form");
|
|
12
12
|
const LayoutContext = /*#__PURE__*/createContext("stacked");
|
|
13
|
+
const DisabledContext = /*#__PURE__*/createContext(false);
|
|
13
14
|
export const usePropertyListDensity = () => useContext(DensityContext);
|
|
14
15
|
export const usePropertyListLayout = () => useContext(LayoutContext);
|
|
16
|
+
export const usePropertyListDisabled = () => useContext(DisabledContext);
|
|
15
17
|
|
|
16
18
|
/** Sets the layout of the rows below it: one line each, or the three columns of a table. */
|
|
17
19
|
export const PropertyListLayout = _ref => {
|
|
@@ -33,24 +35,30 @@ export const PropertyListDivider = () => /*#__PURE__*/React.createElement(Styled
|
|
|
33
35
|
export const PropertyList = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
34
36
|
let _ref2$density = _ref2.density,
|
|
35
37
|
density = _ref2$density === void 0 ? "form" : _ref2$density,
|
|
38
|
+
_ref2$disabled = _ref2.disabled,
|
|
39
|
+
disabled = _ref2$disabled === void 0 ? false : _ref2$disabled,
|
|
36
40
|
className = _ref2.className,
|
|
37
41
|
children = _ref2.children,
|
|
38
42
|
rest = _objectWithoutPropertiesLoose(_ref2, _excluded);
|
|
39
43
|
const parts = Children.toArray(children).filter(Boolean);
|
|
40
44
|
return /*#__PURE__*/React.createElement(DensityContext.Provider, {
|
|
41
45
|
value: density
|
|
46
|
+
}, /*#__PURE__*/React.createElement(DisabledContext.Provider, {
|
|
47
|
+
value: disabled
|
|
42
48
|
}, /*#__PURE__*/React.createElement(StyledPropertyList, _extends({}, rest, {
|
|
43
49
|
ref: ref,
|
|
44
50
|
variant: "raised",
|
|
45
51
|
radius: 20,
|
|
46
52
|
shadow: density === "page",
|
|
53
|
+
$disabled: disabled,
|
|
54
|
+
"aria-disabled": disabled || undefined,
|
|
47
55
|
className: classnames("c-property-list", className)
|
|
48
56
|
}), parts.map((part, index) => {
|
|
49
57
|
var _key;
|
|
50
58
|
return /*#__PURE__*/React.createElement(Fragment, {
|
|
51
59
|
key: (_key = part.key) != null ? _key : index
|
|
52
60
|
}, index > 0 ? /*#__PURE__*/React.createElement(PropertyListDivider, null) : null, part);
|
|
53
|
-
})));
|
|
61
|
+
}))));
|
|
54
62
|
});
|
|
55
63
|
PropertyList.displayName = "PropertyList";
|
|
56
64
|
export const PropertyListValue = _ref3 => {
|
|
@@ -115,18 +123,25 @@ export const PropertyListRow = /*#__PURE__*/forwardRef((_ref6, ref) => {
|
|
|
115
123
|
readOnly = _ref6$readOnly === void 0 ? false : _ref6$readOnly,
|
|
116
124
|
_ref6$chevron = _ref6.chevron,
|
|
117
125
|
chevron = _ref6$chevron === void 0 ? true : _ref6$chevron,
|
|
126
|
+
_ref6$disabled = _ref6.disabled,
|
|
127
|
+
disabled = _ref6$disabled === void 0 ? false : _ref6$disabled,
|
|
118
128
|
className = _ref6.className,
|
|
119
129
|
children = _ref6.children,
|
|
120
130
|
rest = _objectWithoutPropertiesLoose(_ref6, _excluded2);
|
|
131
|
+
const isDisabled = usePropertyListDisabled() || disabled;
|
|
121
132
|
const density = usePropertyListDensity();
|
|
122
133
|
const layout = usePropertyListLayout();
|
|
123
134
|
const caret = !readOnly && chevron ? /*#__PURE__*/React.createElement(StyledPropertyListChevron, null, /*#__PURE__*/React.createElement(ArrowDownSmallIcon, null)) : null;
|
|
124
135
|
return /*#__PURE__*/React.createElement(StyledPropertyListRow, _extends({}, rest, {
|
|
125
136
|
as: readOnly ? "div" : "button",
|
|
126
137
|
ref: ref
|
|
127
|
-
}, readOnly ?
|
|
128
|
-
|
|
138
|
+
}, readOnly ? {
|
|
139
|
+
"aria-disabled": isDisabled || undefined
|
|
140
|
+
} : {
|
|
141
|
+
type: "button",
|
|
142
|
+
disabled: isDisabled
|
|
129
143
|
}, {
|
|
144
|
+
$disabled: isDisabled,
|
|
130
145
|
$layout: layout,
|
|
131
146
|
$density: density,
|
|
132
147
|
$tone: tone,
|
|
@@ -145,12 +160,15 @@ PropertyListRow.displayName = "PropertyListRow";
|
|
|
145
160
|
export const PropertyListToggle = /*#__PURE__*/forwardRef((_ref7, ref) => {
|
|
146
161
|
let _ref7$expanded = _ref7.expanded,
|
|
147
162
|
expanded = _ref7$expanded === void 0 ? false : _ref7$expanded,
|
|
163
|
+
disabled = _ref7.disabled,
|
|
148
164
|
className = _ref7.className,
|
|
149
165
|
children = _ref7.children,
|
|
150
166
|
rest = _objectWithoutPropertiesLoose(_ref7, _excluded3);
|
|
167
|
+
const isDisabled = usePropertyListDisabled() || disabled;
|
|
151
168
|
return /*#__PURE__*/React.createElement(StyledPropertyListToggle, _extends({
|
|
152
169
|
type: "button"
|
|
153
170
|
}, rest, {
|
|
171
|
+
disabled: isDisabled,
|
|
154
172
|
ref: ref,
|
|
155
173
|
"aria-expanded": expanded,
|
|
156
174
|
className: classnames("c-property-list__toggle", className)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyList.js","names":["React","Children","Fragment","createContext","forwardRef","useContext","classnames","StyledPropertyList","StyledPropertyListAddIcon","StyledPropertyListBranch","StyledPropertyListBranchLine","StyledPropertyListChevron","StyledPropertyListDivider","StyledPropertyListIcon","StyledPropertyListLabelText","StyledPropertyListRow","StyledPropertyListTableAction","StyledPropertyListTableLabel","StyledPropertyListTableValue","StyledPropertyListToggle","StyledPropertyListValue","AddCrossTinyIcon","ArrowDownSmallIcon","DensityContext","LayoutContext","usePropertyListDensity","usePropertyListLayout","PropertyListLayout","_ref","_ref$value","value","children","createElement","Provider","PropertyListDivider","$layout","$density","className","PropertyList","_ref2","ref","_ref2$density","density","rest","_objectWithoutPropertiesLoose","_excluded","parts","toArray","filter","Boolean","_extends","variant","radius","shadow","map","part","index","_key","key","displayName","PropertyListValue","_ref3","_ref3$placeholder","placeholder","forwardedAs","color","undefined","$placeholder","PropertyListAdd","_ref4","PropertyListLabel","_ref5","icon","label","layout","$size","$scale","weight","PropertyListRow","_ref6","action","_ref6$tone","tone","_ref6$readOnly","readOnly","_ref6$chevron","chevron","_excluded2","caret","as","type","$tone","$clickable","PropertyListToggle","_ref7","_ref7$expanded","expanded","_excluded3","PropertyListBranch","_ref8","_ref8$position","position","_excluded4"],"sources":["../../../../src/components/PropertyList/PropertyList.tsx"],"sourcesContent":["import React, {\n ButtonHTMLAttributes,\n Children,\n Fragment,\n HTMLAttributes,\n ReactElement,\n ReactNode,\n Ref,\n createContext,\n forwardRef,\n useContext,\n} from \"react\";\n\nimport classnames from \"classnames\";\n\nimport {\n PropertyListDensity,\n PropertyListLayoutName,\n PropertyListTone,\n StyledPropertyList,\n StyledPropertyListAddIcon,\n StyledPropertyListBranch,\n StyledPropertyListBranchLine,\n StyledPropertyListChevron,\n StyledPropertyListDivider,\n StyledPropertyListIcon,\n StyledPropertyListLabelText,\n StyledPropertyListRow,\n StyledPropertyListTableAction,\n StyledPropertyListTableLabel,\n StyledPropertyListTableValue,\n StyledPropertyListToggle,\n StyledPropertyListValue,\n} from \"./Styles\";\nimport { AddCrossTinyIcon, ArrowDownSmallIcon } from \"../Icons\";\n\nconst DensityContext = createContext<PropertyListDensity>(\"form\");\nconst LayoutContext = createContext<PropertyListLayoutName>(\"stacked\");\n\nexport const usePropertyListDensity = () => useContext(DensityContext);\nexport const usePropertyListLayout = () => useContext(LayoutContext);\n\n/** Sets the layout of the rows below it: one line each, or the three columns of a table. */\nexport const PropertyListLayout = ({\n value = \"stacked\",\n children,\n}: {\n value?: PropertyListLayoutName;\n children?: ReactNode;\n}) => <LayoutContext.Provider value={value}>{children}</LayoutContext.Provider>;\n\n/** The line between two rows. In a stacked list it starts where the label text starts. */\nexport const PropertyListDivider = () => (\n <StyledPropertyListDivider\n aria-hidden=\"true\"\n $layout={usePropertyListLayout()}\n $density={usePropertyListDensity()}\n className=\"c-property-list__divider\"\n />\n);\n\nexport interface IPropertyListProps extends HTMLAttributes<HTMLDivElement> {\n /** \"form\" for a compact list in a form, \"page\" for a list on a page, with a shadow. */\n density?: PropertyListDensity;\n}\n\nexport const PropertyList = forwardRef<HTMLDivElement, IPropertyListProps>(\n ({ density = \"form\", className, children, ...rest }, ref) => {\n const parts = Children.toArray(children).filter(Boolean);\n\n return (\n <DensityContext.Provider value={density}>\n <StyledPropertyList\n {...rest}\n ref={ref}\n variant=\"raised\"\n radius={20}\n shadow={density === \"page\"}\n className={classnames(\"c-property-list\", className)}\n >\n {parts.map((part, index) => (\n <Fragment key={(part as ReactElement).key ?? index}>\n {index > 0 ? <PropertyListDivider /> : null}\n {part}\n </Fragment>\n ))}\n </StyledPropertyList>\n </DensityContext.Provider>\n );\n }\n);\n\nPropertyList.displayName = \"PropertyList\";\n\nexport interface IPropertyListValueProps {\n /** A row with no value shows its text in the placeholder color. */\n placeholder?: boolean;\n className?: string;\n children?: ReactNode;\n}\n\nexport const PropertyListValue = ({\n placeholder = false,\n className,\n children,\n}: IPropertyListValueProps) => (\n <StyledPropertyListValue\n forwardedAs=\"span\"\n color={placeholder ? \"quaternary\" : undefined}\n $density={usePropertyListDensity()}\n $placeholder={placeholder}\n className={classnames(\"c-property-list__value\", className)}\n data-placeholder={placeholder || undefined}\n >\n {children}\n </StyledPropertyListValue>\n);\n\n/** The \"Add\" of a row: a placeholder with a plus where another row has its chevron. */\nexport const PropertyListAdd = ({ children }: { children?: ReactNode }) => (\n <>\n <PropertyListValue placeholder>{children}</PropertyListValue>\n <StyledPropertyListAddIcon>\n <AddCrossTinyIcon />\n </StyledPropertyListAddIcon>\n </>\n);\n\nexport interface IPropertyListLabelProps {\n icon?: ReactNode;\n label?: ReactNode;\n}\n\nexport const PropertyListLabel = ({ icon, label }: IPropertyListLabelProps) => {\n const density = usePropertyListDensity();\n const layout = usePropertyListLayout();\n\n if (layout === \"table\") {\n return (\n <StyledPropertyListTableLabel className=\"c-property-list__label\">\n <StyledPropertyListIcon $size={16} $scale>\n {icon}\n </StyledPropertyListIcon>\n <StyledPropertyListLabelText\n forwardedAs=\"span\"\n weight=\"medium\"\n $layout={layout}\n $density={density}\n >\n {label}\n </StyledPropertyListLabelText>\n </StyledPropertyListTableLabel>\n );\n }\n\n return (\n <>\n <StyledPropertyListIcon\n $size={density === \"page\" ? 28 : 24}\n $scale={false}\n >\n {icon}\n </StyledPropertyListIcon>\n <StyledPropertyListLabelText\n forwardedAs=\"span\"\n weight=\"medium\"\n $layout={layout}\n $density={density}\n className=\"c-property-list__label\"\n >\n {label}\n </StyledPropertyListLabelText>\n </>\n );\n};\n\nexport interface IPropertyListRowProps\n extends Omit<HTMLAttributes<HTMLElement>, \"children\"> {\n icon?: ReactNode;\n label?: ReactNode;\n value?: ReactNode;\n /** A control before the chevron. */\n action?: ReactNode;\n tone?: PropertyListTone;\n /** A read only row is plain text. A row that can change is one button. */\n readOnly?: boolean;\n chevron?: boolean;\n /** Replaces the label, the value and the action. */\n children?: ReactNode;\n}\n\nexport const PropertyListRow = forwardRef<HTMLElement, IPropertyListRowProps>(\n (\n {\n icon,\n label,\n value,\n action,\n tone = \"regular\",\n readOnly = false,\n chevron = true,\n className,\n children,\n ...rest\n },\n ref\n ) => {\n const density = usePropertyListDensity();\n const layout = usePropertyListLayout();\n const caret =\n !readOnly && chevron ? (\n <StyledPropertyListChevron>\n <ArrowDownSmallIcon />\n </StyledPropertyListChevron>\n ) : null;\n\n return (\n <StyledPropertyListRow\n {...rest}\n as={readOnly ? \"div\" : \"button\"}\n ref={ref as Ref<HTMLDivElement>}\n {...(readOnly ? null : { type: \"button\" })}\n $layout={layout}\n $density={density}\n $tone={tone}\n $clickable={!readOnly}\n className={classnames(\"c-property-list__row\", className)}\n >\n {children ??\n (layout === \"table\" ? (\n <>\n <PropertyListLabel icon={icon} label={label} />\n <StyledPropertyListTableValue>\n {value}\n </StyledPropertyListTableValue>\n <StyledPropertyListTableAction>\n {action}\n {caret}\n </StyledPropertyListTableAction>\n </>\n ) : (\n <>\n <PropertyListLabel icon={icon} label={label} />\n {value}\n {action}\n {caret}\n </>\n ))}\n </StyledPropertyListRow>\n );\n }\n);\n\nPropertyListRow.displayName = \"PropertyListRow\";\n\nexport interface IPropertyListToggleProps\n extends ButtonHTMLAttributes<HTMLButtonElement> {\n /** The rows that the toggle opens are on the screen. */\n expanded?: boolean;\n}\n\n/** The last row of a list: it opens and closes the rows with no value. */\nexport const PropertyListToggle = forwardRef<\n HTMLButtonElement,\n IPropertyListToggleProps\n>(({ expanded = false, className, children, ...rest }, ref) => (\n <StyledPropertyListToggle\n type=\"button\"\n {...rest}\n ref={ref}\n aria-expanded={expanded}\n className={classnames(\"c-property-list__toggle\", className)}\n >\n {children}\n </StyledPropertyListToggle>\n));\n\nPropertyListToggle.displayName = \"PropertyListToggle\";\n\nexport interface IPropertyListBranchProps\n extends HTMLAttributes<HTMLSpanElement> {\n /** \"middle\" continues the line to the next row of the branch. */\n position?: \"middle\" | \"last\";\n}\n\n/** The tree line before a row that belongs to the row above it. Its parent must be positioned. */\nexport const PropertyListBranch = ({\n position = \"last\",\n ...rest\n}: IPropertyListBranchProps) => (\n <>\n <StyledPropertyListBranch aria-hidden=\"true\" {...rest} />\n {position === \"middle\" ? (\n <StyledPropertyListBranchLine aria-hidden=\"true\" />\n ) : null}\n </>\n);\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,IAEVC,QAAQ,EACRC,QAAQ,EAKRC,aAAa,EACbC,UAAU,EACVC,UAAU,QACL,OAAO;AAEd,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAIEC,kBAAkB,EAClBC,yBAAyB,EACzBC,wBAAwB,EACxBC,4BAA4B,EAC5BC,yBAAyB,EACzBC,yBAAyB,EACzBC,sBAAsB,EACtBC,2BAA2B,EAC3BC,qBAAqB,EACrBC,6BAA6B,EAC7BC,4BAA4B,EAC5BC,4BAA4B,EAC5BC,wBAAwB,EACxBC,uBAAuB,QAClB,UAAU;AACjB,SAASC,gBAAgB,EAAEC,kBAAkB,QAAQ,UAAU;AAE/D,MAAMC,cAAc,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yD,KAAA,CAATzD,SAAS;IAAEN,QAAQ,GAAA+D,KAAA,CAAR/D,QAAQ;IAAKY,IAAI,GAAAC,6BAAA,CAAAkD,KAAA,EAAAG,UAAA;EAAA,oBACjDjG,KAAA,CAAAgC,aAAA,CAACb,wBAAwB,EAAA+B,QAAA;IACvBwC,IAAI,EAAC;EAAQ,GACT/C,IAAI;IACRH,GAAG,EAAEA,GAAI;IACT,iBAAewD,QAAS;IACxB3D,SAAS,EAAE/B,UAAU,CAAC,yBAAyB,EAAE+B,SAAS;EAAE,IAE3DN,QACuB,CAAC;AAAA,CAC5B,CAAC;AAEF8D,kBAAkB,CAAClC,WAAW,GAAG,oBAAoB;AAQrD;AACA,OAAO,MAAMuC,kBAAkB,GAAGC,KAAA;EAAA,IAAAC,cAAA,GAAAD,KAAA,CAChCE,QAAQ;IAARA,QAAQ,GAAAD,cAAA,cAAG,MAAM,GAAAA,cAAA;IACdzD,IAAI,GAAAC,6BAAA,CAAAuD,KAAA,EAAAG,UAAA;EAAA,oBAEPtG,KAAA,CAAAgC,aAAA,CAAAhC,KAAA,CAAAE,QAAA,qBACEF,KAAA,CAAAgC,aAAA,CAACvB,wBAAwB,EAAAyC,QAAA;IAAC,eAAY;EAAM,GAAKP,IAAI,CAAG,CAAC,EACxD0D,QAAQ,KAAK,QAAQ,gBACpBrG,KAAA,CAAAgC,aAAA,CAACtB,4BAA4B;IAAC,eAAY;EAAM,CAAE,CAAC,GACjD,IACJ,CAAC;AAAA,CACJ","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"PropertyList.js","names":["React","Children","Fragment","createContext","forwardRef","useContext","classnames","StyledPropertyList","StyledPropertyListAddIcon","StyledPropertyListBranch","StyledPropertyListBranchLine","StyledPropertyListChevron","StyledPropertyListDivider","StyledPropertyListIcon","StyledPropertyListLabelText","StyledPropertyListRow","StyledPropertyListTableAction","StyledPropertyListTableLabel","StyledPropertyListTableValue","StyledPropertyListToggle","StyledPropertyListValue","AddCrossTinyIcon","ArrowDownSmallIcon","DensityContext","LayoutContext","DisabledContext","usePropertyListDensity","usePropertyListLayout","usePropertyListDisabled","PropertyListLayout","_ref","_ref$value","value","children","createElement","Provider","PropertyListDivider","$layout","$density","className","PropertyList","_ref2","ref","_ref2$density","density","_ref2$disabled","disabled","rest","_objectWithoutPropertiesLoose","_excluded","parts","toArray","filter","Boolean","_extends","variant","radius","shadow","$disabled","undefined","map","part","index","_key","key","displayName","PropertyListValue","_ref3","_ref3$placeholder","placeholder","forwardedAs","color","$placeholder","PropertyListAdd","_ref4","PropertyListLabel","_ref5","icon","label","layout","$size","$scale","weight","PropertyListRow","_ref6","action","_ref6$tone","tone","_ref6$readOnly","readOnly","_ref6$chevron","chevron","_ref6$disabled","_excluded2","isDisabled","caret","as","type","$tone","$clickable","PropertyListToggle","_ref7","_ref7$expanded","expanded","_excluded3","PropertyListBranch","_ref8","_ref8$position","position","_excluded4"],"sources":["../../../../src/components/PropertyList/PropertyList.tsx"],"sourcesContent":["import React, {\n ButtonHTMLAttributes,\n Children,\n Fragment,\n HTMLAttributes,\n ReactElement,\n ReactNode,\n Ref,\n createContext,\n forwardRef,\n useContext,\n} from \"react\";\n\nimport classnames from \"classnames\";\n\nimport {\n PropertyListDensity,\n PropertyListLayoutName,\n PropertyListTone,\n StyledPropertyList,\n StyledPropertyListAddIcon,\n StyledPropertyListBranch,\n StyledPropertyListBranchLine,\n StyledPropertyListChevron,\n StyledPropertyListDivider,\n StyledPropertyListIcon,\n StyledPropertyListLabelText,\n StyledPropertyListRow,\n StyledPropertyListTableAction,\n StyledPropertyListTableLabel,\n StyledPropertyListTableValue,\n StyledPropertyListToggle,\n StyledPropertyListValue,\n} from \"./Styles\";\nimport { AddCrossTinyIcon, ArrowDownSmallIcon } from \"../Icons\";\n\nconst DensityContext = createContext<PropertyListDensity>(\"form\");\nconst LayoutContext = createContext<PropertyListLayoutName>(\"stacked\");\nconst DisabledContext = createContext(false);\n\nexport const usePropertyListDensity = () => useContext(DensityContext);\nexport const usePropertyListLayout = () => useContext(LayoutContext);\nexport const usePropertyListDisabled = () => useContext(DisabledContext);\n\n/** Sets the layout of the rows below it: one line each, or the three columns of a table. */\nexport const PropertyListLayout = ({\n value = \"stacked\",\n children,\n}: {\n value?: PropertyListLayoutName;\n children?: ReactNode;\n}) => <LayoutContext.Provider value={value}>{children}</LayoutContext.Provider>;\n\n/** The line between two rows. In a stacked list it starts where the label text starts. */\nexport const PropertyListDivider = () => (\n <StyledPropertyListDivider\n aria-hidden=\"true\"\n $layout={usePropertyListLayout()}\n $density={usePropertyListDensity()}\n className=\"c-property-list__divider\"\n />\n);\n\nexport interface IPropertyListProps extends HTMLAttributes<HTMLDivElement> {\n /** \"form\" for a compact list in a form, \"page\" for a list on a page, with a shadow. */\n density?: PropertyListDensity;\n /** Every row of the list is dimmed and takes no click and no focus. */\n disabled?: boolean;\n}\n\nexport const PropertyList = forwardRef<HTMLDivElement, IPropertyListProps>(\n (\n { density = \"form\", disabled = false, className, children, ...rest },\n ref\n ) => {\n const parts = Children.toArray(children).filter(Boolean);\n\n return (\n <DensityContext.Provider value={density}>\n <DisabledContext.Provider value={disabled}>\n <StyledPropertyList\n {...rest}\n ref={ref}\n variant=\"raised\"\n radius={20}\n shadow={density === \"page\"}\n $disabled={disabled}\n aria-disabled={disabled || undefined}\n className={classnames(\"c-property-list\", className)}\n >\n {parts.map((part, index) => (\n <Fragment key={(part as ReactElement).key ?? index}>\n {index > 0 ? <PropertyListDivider /> : null}\n {part}\n </Fragment>\n ))}\n </StyledPropertyList>\n </DisabledContext.Provider>\n </DensityContext.Provider>\n );\n }\n);\n\nPropertyList.displayName = \"PropertyList\";\n\nexport interface IPropertyListValueProps {\n /** A row with no value shows its text in the placeholder color. */\n placeholder?: boolean;\n className?: string;\n children?: ReactNode;\n}\n\nexport const PropertyListValue = ({\n placeholder = false,\n className,\n children,\n}: IPropertyListValueProps) => (\n <StyledPropertyListValue\n forwardedAs=\"span\"\n color={placeholder ? \"quaternary\" : undefined}\n $density={usePropertyListDensity()}\n $placeholder={placeholder}\n className={classnames(\"c-property-list__value\", className)}\n data-placeholder={placeholder || undefined}\n >\n {children}\n </StyledPropertyListValue>\n);\n\n/** The \"Add\" of a row: a placeholder with a plus where another row has its chevron. */\nexport const PropertyListAdd = ({ children }: { children?: ReactNode }) => (\n <>\n <PropertyListValue placeholder>{children}</PropertyListValue>\n <StyledPropertyListAddIcon>\n <AddCrossTinyIcon />\n </StyledPropertyListAddIcon>\n </>\n);\n\nexport interface IPropertyListLabelProps {\n icon?: ReactNode;\n label?: ReactNode;\n}\n\nexport const PropertyListLabel = ({ icon, label }: IPropertyListLabelProps) => {\n const density = usePropertyListDensity();\n const layout = usePropertyListLayout();\n\n if (layout === \"table\") {\n return (\n <StyledPropertyListTableLabel className=\"c-property-list__label\">\n <StyledPropertyListIcon $size={16} $scale>\n {icon}\n </StyledPropertyListIcon>\n <StyledPropertyListLabelText\n forwardedAs=\"span\"\n weight=\"medium\"\n $layout={layout}\n $density={density}\n >\n {label}\n </StyledPropertyListLabelText>\n </StyledPropertyListTableLabel>\n );\n }\n\n return (\n <>\n <StyledPropertyListIcon\n $size={density === \"page\" ? 28 : 24}\n $scale={false}\n >\n {icon}\n </StyledPropertyListIcon>\n <StyledPropertyListLabelText\n forwardedAs=\"span\"\n weight=\"medium\"\n $layout={layout}\n $density={density}\n className=\"c-property-list__label\"\n >\n {label}\n </StyledPropertyListLabelText>\n </>\n );\n};\n\nexport interface IPropertyListRowProps\n extends Omit<HTMLAttributes<HTMLElement>, \"children\"> {\n icon?: ReactNode;\n label?: ReactNode;\n value?: ReactNode;\n /** A control before the chevron. */\n action?: ReactNode;\n tone?: PropertyListTone;\n /** A read only row is plain text. A row that can change is one button. */\n readOnly?: boolean;\n chevron?: boolean;\n /** Dimmed, with no click and no focus. A disabled list disables its rows. */\n disabled?: boolean;\n /** Replaces the label, the value and the action. */\n children?: ReactNode;\n}\n\nexport const PropertyListRow = forwardRef<HTMLElement, IPropertyListRowProps>(\n (\n {\n icon,\n label,\n value,\n action,\n tone = \"regular\",\n readOnly = false,\n chevron = true,\n disabled = false,\n className,\n children,\n ...rest\n },\n ref\n ) => {\n const isDisabled = usePropertyListDisabled() || disabled;\n const density = usePropertyListDensity();\n const layout = usePropertyListLayout();\n const caret =\n !readOnly && chevron ? (\n <StyledPropertyListChevron>\n <ArrowDownSmallIcon />\n </StyledPropertyListChevron>\n ) : null;\n\n return (\n <StyledPropertyListRow\n {...rest}\n as={readOnly ? \"div\" : \"button\"}\n ref={ref as Ref<HTMLDivElement>}\n {...(readOnly\n ? { \"aria-disabled\": isDisabled || undefined }\n : { type: \"button\", disabled: isDisabled })}\n $disabled={isDisabled}\n $layout={layout}\n $density={density}\n $tone={tone}\n $clickable={!readOnly}\n className={classnames(\"c-property-list__row\", className)}\n >\n {children ??\n (layout === \"table\" ? (\n <>\n <PropertyListLabel icon={icon} label={label} />\n <StyledPropertyListTableValue>\n {value}\n </StyledPropertyListTableValue>\n <StyledPropertyListTableAction>\n {action}\n {caret}\n </StyledPropertyListTableAction>\n </>\n ) : (\n <>\n <PropertyListLabel icon={icon} label={label} />\n {value}\n {action}\n {caret}\n </>\n ))}\n </StyledPropertyListRow>\n );\n }\n);\n\nPropertyListRow.displayName = \"PropertyListRow\";\n\nexport interface IPropertyListToggleProps\n extends ButtonHTMLAttributes<HTMLButtonElement> {\n /** The rows that the toggle opens are on the screen. */\n expanded?: boolean;\n}\n\n/** The last row of a list: it opens and closes the rows with no value. */\nexport const PropertyListToggle = forwardRef<\n HTMLButtonElement,\n IPropertyListToggleProps\n>(({ expanded = false, disabled, className, children, ...rest }, ref) => {\n const isDisabled = usePropertyListDisabled() || disabled;\n\n return (\n <StyledPropertyListToggle\n type=\"button\"\n {...rest}\n disabled={isDisabled}\n ref={ref}\n aria-expanded={expanded}\n className={classnames(\"c-property-list__toggle\", className)}\n >\n {children}\n </StyledPropertyListToggle>\n );\n});\n\nPropertyListToggle.displayName = \"PropertyListToggle\";\n\nexport interface IPropertyListBranchProps\n extends HTMLAttributes<HTMLSpanElement> {\n /** \"middle\" continues the line to the next row of the branch. */\n position?: \"middle\" | \"last\";\n}\n\n/** The tree line before a row that belongs to the row above it. Its parent must be positioned. */\nexport const PropertyListBranch = ({\n position = \"last\",\n ...rest\n}: IPropertyListBranchProps) => (\n <>\n <StyledPropertyListBranch aria-hidden=\"true\" {...rest} />\n {position === \"middle\" ? (\n <StyledPropertyListBranchLine aria-hidden=\"true\" />\n ) : null}\n </>\n);\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,IAEVC,QAAQ,EACRC,QAAQ,EAKRC,aAAa,EACbC,UAAU,EACVC,UAAU,QACL,OAAO;AAEd,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAIEC,kBAAkB,EAClBC,yBAAyB,EACzBC,wBAAwB,EACxBC,4BAA4B,EAC5BC,yBAAyB,EACzBC,yBAAyB,EACzBC,sBAAsB,EACtBC,2BAA2B,EAC3BC,qBAAqB,EACrBC,6BAA6B,EAC7BC,4BAA4B,EAC5BC,4BAA4B,EAC5BC,wBAAwB,EACxBC,uBAAuB,QAClB,UAAU;AACjB,SAASC,gBAAgB,EAAEC,kBAAkB,QAAQ,UAAU;AAE/D,MAAMC,cAAc,gBAAGpB,aAAa,CAAsB,MAAM,CAAC;AACjE,MAAMqB,aAAa,gBAAGrB,aAAa,CAAyB,SAAS,CAAC;AACtE,MAAMsB,eAAe,gBAAGtB,aAAa,CAAC,KAAK,CAAC;AAE5C,OAAO,MAAMuB,sBAAsB,GAAGA,CAAA,KAAMrB,UAAU,CAACkB,cAAc,CAAC;AACtE,OAAO,MAAMI,qBAAqB,GAAGA,CAAA,KAAMtB,UAAU,CAACmB,aAAa,CAAC;AACpE,OAAO,MAAMI,uBAAuB,GAAGA,CAAA,KAAMvB,UAAU,CAACoB,eAAe,CAAC;;AAExE;AACA,OAAO,MAAMI,kBAAkB,GAAGC,IAAA;EAAA,IAAAC,UAAA,GAAAD,IAAA,CAChCE,KAAK;IAALA,KAAK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
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export type PropertyListDensity = "form" | "page";
|
|
2
2
|
export type PropertyListLayoutName = "stacked" | "table";
|
|
3
3
|
export type PropertyListTone = "regular" | "alert";
|
|
4
|
-
export declare const StyledPropertyList: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Omit<import("react").HTMLAttributes<HTMLDivElement> & import("..").ICardProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>, any, {
|
|
4
|
+
export declare const StyledPropertyList: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Omit<import("react").HTMLAttributes<HTMLDivElement> & import("..").ICardProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>, any, {
|
|
5
|
+
$disabled?: boolean;
|
|
6
|
+
}, never>;
|
|
5
7
|
export declare const StyledPropertyListDivider: import("styled-components").StyledComponent<"div", any, {
|
|
6
8
|
$layout: PropertyListLayoutName;
|
|
7
9
|
$density: PropertyListDensity;
|
|
@@ -11,6 +13,7 @@ export declare const StyledPropertyListRow: import("styled-components").StyledCo
|
|
|
11
13
|
$density: PropertyListDensity;
|
|
12
14
|
$tone: PropertyListTone;
|
|
13
15
|
$clickable: boolean;
|
|
16
|
+
$disabled?: boolean;
|
|
14
17
|
}, never>;
|
|
15
18
|
export declare const StyledPropertyListTableLabel: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
16
19
|
export declare const StyledPropertyListIcon: import("styled-components").StyledComponent<"span", any, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Styles.d.ts","sourceRoot":"","sources":["../../../../src/components/PropertyList/Styles.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,MAAM,CAAC;AAClD,MAAM,MAAM,sBAAsB,GAAG,SAAS,GAAG,OAAO,CAAC;AACzD,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Styles.d.ts","sourceRoot":"","sources":["../../../../src/components/PropertyList/Styles.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,MAAM,CAAC;AAClD,MAAM,MAAM,sBAAsB,GAAG,SAAS,GAAG,OAAO,CAAC;AACzD,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,OAAO,CAAC;AAKnD,eAAO,MAAM,kBAAkB;gBAA8B,OAAO;SAgBnE,CAAC;AAEF,eAAO,MAAM,yBAAyB;aAC3B,sBAAsB;cACrB,mBAAmB;SAO9B,CAAC;AAKF,eAAO,MAAM,qBAAqB;aACvB,sBAAsB;cACrB,mBAAmB;WACtB,gBAAgB;gBACX,OAAO;gBACP,OAAO;SAuDpB,CAAC;AAEF,eAAO,MAAM,4BAA4B,qEAMxC,CAAC;AAEF,eAAO,MAAM,sBAAsB;WAC1B,MAAM;YACL,OAAO;SAahB,CAAC;AAEF,eAAO,MAAM,2BAA2B;aAC7B,sBAAsB;cACrB,mBAAmB;SAgB9B,CAAC;AAEF,eAAO,MAAM,uBAAuB;cACxB,mBAAmB;kBACf,OAAO;SAgBtB,CAAC;AAEF,eAAO,MAAM,yBAAyB,qEAWrC,CAAC;AAEF,eAAO,MAAM,4BAA4B,qEAKxC,CAAC;AAEF,eAAO,MAAM,6BAA6B,qEAOzC,CAAC;AAEF,eAAO,MAAM,yBAAyB,qEAOrC,CAAC;AAEF,eAAO,MAAM,wBAAwB,uEAwBpC,CAAC;AAEF,eAAO,MAAM,wBAAwB,qEAWpC,CAAC;AAEF,eAAO,MAAM,4BAA4B,qEAQxC,CAAC"}
|
|
@@ -1,33 +1,42 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
2
|
import { Card } from "../Card";
|
|
3
3
|
import { Body2 } from "../Typography";
|
|
4
|
+
const disabledSurface = "color-mix(in srgb, var(--surface-raised) 50%, transparent)";
|
|
4
5
|
export const StyledPropertyList = styled(Card).withConfig({
|
|
5
6
|
displayName: "Styles__StyledPropertyList",
|
|
6
7
|
componentId: "sc-ssdfzo-0"
|
|
7
|
-
})(["display:flex;flex-direction:column;overflow:clip;"]
|
|
8
|
+
})(["display:flex;flex-direction:column;overflow:clip;", ""], _ref => {
|
|
9
|
+
let $disabled = _ref.$disabled;
|
|
10
|
+
return $disabled && css(["&&{background-color:", ";}&&:hover{background-color:", ";}"], disabledSurface, disabledSurface);
|
|
11
|
+
});
|
|
8
12
|
export const StyledPropertyListDivider = styled.div.withConfig({
|
|
9
13
|
displayName: "Styles__StyledPropertyListDivider",
|
|
10
14
|
componentId: "sc-ssdfzo-1"
|
|
11
|
-
})(["flex-shrink:0;height:1px;background-color:var(--border-raised);", ""],
|
|
12
|
-
let $layout =
|
|
13
|
-
$density =
|
|
15
|
+
})(["flex-shrink:0;height:1px;background-color:var(--border-raised);", ""], _ref2 => {
|
|
16
|
+
let $layout = _ref2.$layout,
|
|
17
|
+
$density = _ref2.$density;
|
|
14
18
|
return $layout === "stacked" && "margin-left: " + ($density === "page" ? 44 : 46) + "px;";
|
|
15
19
|
});
|
|
16
20
|
const highlight = "linear-gradient(var(--highlight-dark), var(--highlight-dark))";
|
|
17
21
|
export const StyledPropertyListRow = styled.div.withConfig({
|
|
18
22
|
displayName: "Styles__StyledPropertyListRow",
|
|
19
23
|
componentId: "sc-ssdfzo-2"
|
|
20
|
-
})(["position:relative;width:100%;border:0;text-align:left;background-color:", ";", " ", ""],
|
|
21
|
-
let $tone =
|
|
24
|
+
})(["position:relative;width:100%;border:0;text-align:left;background-color:", ";", " ", " ", ""], _ref3 => {
|
|
25
|
+
let $tone = _ref3.$tone;
|
|
22
26
|
return $tone === "alert" ? "var(--alert-surface-subtle)" : "transparent";
|
|
23
|
-
}, _ref3 => {
|
|
24
|
-
let $layout = _ref3.$layout,
|
|
25
|
-
$density = _ref3.$density;
|
|
26
|
-
return $layout === "table" ? css(["display:grid;grid-template-columns:185px minmax(0,1fr) auto;align-items:center;min-height:36px;padding:4px 12px;"]) : css(["display:flex;align-items:center;gap:8px;min-height:", "px;padding:6px 12px;"], $density === "page" ? 44 : 40);
|
|
27
27
|
}, _ref4 => {
|
|
28
|
-
let $
|
|
29
|
-
$
|
|
30
|
-
return $
|
|
28
|
+
let $layout = _ref4.$layout,
|
|
29
|
+
$density = _ref4.$density;
|
|
30
|
+
return $layout === "table" ? css(["display:grid;grid-template-columns:185px minmax(0,1fr) auto;align-items:center;min-height:36px;padding:4px 12px;"]) : css(["display:flex;align-items:center;gap:8px;min-height:", "px;padding:6px 12px;"], $density === "page" ? 44 : 40);
|
|
31
|
+
}, _ref5 => {
|
|
32
|
+
let $disabled = _ref5.$disabled,
|
|
33
|
+
$density = _ref5.$density;
|
|
34
|
+
return $disabled && css(["cursor:default;> *{opacity:0.4;}&& .c-property-list__value[data-placeholder]{color:", ";}"], $density === "page" ? "var(--muted-text)" : "var(--color-theme-800)");
|
|
35
|
+
}, _ref6 => {
|
|
36
|
+
let $clickable = _ref6.$clickable,
|
|
37
|
+
$disabled = _ref6.$disabled,
|
|
38
|
+
$tone = _ref6.$tone;
|
|
39
|
+
return $clickable && !$disabled && css(["cursor:pointer;&:hover,&[aria-expanded=\"true\"]{", "}"], $tone === "alert" ? "background-image: " + highlight + ";" : "background-color: var(--color-theme-200);");
|
|
31
40
|
});
|
|
32
41
|
export const StyledPropertyListTableLabel = styled.span.withConfig({
|
|
33
42
|
displayName: "Styles__StyledPropertyListTableLabel",
|
|
@@ -36,34 +45,34 @@ export const StyledPropertyListTableLabel = styled.span.withConfig({
|
|
|
36
45
|
export const StyledPropertyListIcon = styled.span.withConfig({
|
|
37
46
|
displayName: "Styles__StyledPropertyListIcon",
|
|
38
47
|
componentId: "sc-ssdfzo-4"
|
|
39
|
-
})(["display:flex;flex-shrink:0;align-items:center;justify-content:center;width:", "px;height:", "px;& svg{fill:var(--color-theme-700);", "}"],
|
|
40
|
-
let $size =
|
|
48
|
+
})(["display:flex;flex-shrink:0;align-items:center;justify-content:center;width:", "px;height:", "px;& svg{fill:var(--color-theme-700);", "}"], _ref7 => {
|
|
49
|
+
let $size = _ref7.$size;
|
|
41
50
|
return $size;
|
|
42
|
-
},
|
|
43
|
-
let $size =
|
|
51
|
+
}, _ref8 => {
|
|
52
|
+
let $size = _ref8.$size;
|
|
44
53
|
return $size;
|
|
45
|
-
},
|
|
46
|
-
let $scale =
|
|
47
|
-
$size =
|
|
54
|
+
}, _ref9 => {
|
|
55
|
+
let $scale = _ref9.$scale,
|
|
56
|
+
$size = _ref9.$size;
|
|
48
57
|
return $scale && "width: " + $size + "px; height: " + $size + "px;";
|
|
49
58
|
});
|
|
50
59
|
export const StyledPropertyListLabelText = styled(Body2).withConfig({
|
|
51
60
|
displayName: "Styles__StyledPropertyListLabelText",
|
|
52
61
|
componentId: "sc-ssdfzo-5"
|
|
53
|
-
})(["&&{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--color-theme-700);", "}"],
|
|
54
|
-
let $layout =
|
|
55
|
-
$density =
|
|
62
|
+
})(["&&{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--color-theme-700);", "}"], _ref0 => {
|
|
63
|
+
let $layout = _ref0.$layout,
|
|
64
|
+
$density = _ref0.$density;
|
|
56
65
|
return $layout === "stacked" && css(["flex:1 1 0%;", ""], $density === "page" ? "margin-left: -4px;" : "padding-left: 6px;");
|
|
57
66
|
});
|
|
58
67
|
export const StyledPropertyListValue = styled(Body2).withConfig({
|
|
59
68
|
displayName: "Styles__StyledPropertyListValue",
|
|
60
69
|
componentId: "sc-ssdfzo-6"
|
|
61
|
-
})(["&&{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:", ";", "}"],
|
|
62
|
-
let $density =
|
|
70
|
+
})(["&&{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:", ";", "}"], _ref1 => {
|
|
71
|
+
let $density = _ref1.$density;
|
|
63
72
|
return $density === "page" ? "15px" : "calc(1em + 1px)";
|
|
64
|
-
},
|
|
65
|
-
let $placeholder =
|
|
66
|
-
$density =
|
|
73
|
+
}, _ref10 => {
|
|
74
|
+
let $placeholder = _ref10.$placeholder,
|
|
75
|
+
$density = _ref10.$density;
|
|
67
76
|
return !$placeholder && "color: " + ($density === "page" ? "var(--muted-text)" : "var(--color-theme-800)") + ";";
|
|
68
77
|
});
|
|
69
78
|
export const StyledPropertyListAddIcon = styled.span.withConfig({
|
|
@@ -85,7 +94,7 @@ export const StyledPropertyListChevron = styled.span.withConfig({
|
|
|
85
94
|
export const StyledPropertyListToggle = styled.button.withConfig({
|
|
86
95
|
displayName: "Styles__StyledPropertyListToggle",
|
|
87
96
|
componentId: "sc-ssdfzo-11"
|
|
88
|
-
})(["display:flex;align-items:center;width:100%;min-height:36px;padding:0 12px;border:0;background-color:transparent;color:var(--color-theme-600);font-size:13px;line-height:20px;text-align:left;cursor:pointer;&:hover,&:focus-visible{background-color:var(--color-theme-200);}"]);
|
|
97
|
+
})(["display:flex;align-items:center;width:100%;min-height:36px;padding:0 12px;border:0;background-color:transparent;color:var(--color-theme-600);font-size:13px;line-height:20px;text-align:left;cursor:pointer;&:hover,&:focus-visible{background-color:var(--color-theme-200);}&:disabled{cursor:default;opacity:0.4;background-color:transparent;}"]);
|
|
89
98
|
export const StyledPropertyListBranch = styled.span.withConfig({
|
|
90
99
|
displayName: "Styles__StyledPropertyListBranch",
|
|
91
100
|
componentId: "sc-ssdfzo-12"
|