@darajs/components 1.16.23 → 1.17.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/common/button/button.d.ts.map +1 -1
- package/dist/common/button/button.js +1 -17
- package/dist/common/button/button.js.map +1 -1
- package/dist/common/if/if.d.ts +1 -10
- package/dist/common/if/if.d.ts.map +1 -1
- package/dist/common/if/if.js +1 -33
- package/dist/common/if/if.js.map +1 -1
- package/dist/common/text/text.d.ts.map +1 -1
- package/dist/common/text/text.js +5 -3
- package/dist/common/text/text.js.map +1 -1
- package/dist/dara_components-1.17.0-py3-none-any.whl +0 -0
- package/dist/umd/dara.components.umd.js +16 -50
- package/package.json +12 -12
- package/dist/dara_components-1.16.23-py3-none-any.whl +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../js/common/button/button.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,MAAM,EACN,iBAAiB,EACjB,SAAS,EAGT,oBAAoB,EACpB,QAAQ,EAOX,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../js/common/button/button.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,MAAM,EACN,iBAAiB,EACjB,SAAS,EAGT,oBAAoB,EACpB,QAAQ,EAOX,MAAM,cAAc,CAAC;AAMtB,KAAK,kBAAkB,CAAC,IAAI,EAAE,MAAM,IAAI;KACnC,QAAQ,IAAI,MAAM,IAAI,IAAI,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC;CACxE,CAAC;AAEF,UAAU,WAAY,SAAQ,kBAAkB,CAAC,oBAAoB,EAAE,UAAU,CAAC;IAC9E,QAAQ,EAAE,KAAK,CAAC,iBAAiB,CAAC,GAAG,MAAM,CAAC;IAC5C,yCAAyC;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,oCAAoC;IACpC,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;IACvD,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,OAAO,EAAE,MAAM,CAAC;IAChB,oGAAoG;IACpG,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,6CAA6C;IAC7C,OAAO,EAAE,SAAS,GAAG,WAAW,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;CAClE;AAaD;;;;GAIG;AACH,iBAAS,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,CAAC,OAAO,CAwC/C;AAED,eAAe,MAAM,CAAC"}
|
|
@@ -1,24 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { DisplayCtx, DynamicComponent, getIcon, injectCss, useAction, useActionIsLoading, useComponentStyles,
|
|
2
|
+
import { DisplayCtx, DynamicComponent, getIcon, injectCss, useAction, useActionIsLoading, useComponentStyles, useConditionOrVariable, } from '@darajs/core';
|
|
3
3
|
import styled from '@darajs/styled-components';
|
|
4
4
|
import { Button as UiButton } from '@darajs/ui-components';
|
|
5
5
|
import { ComponentType } from '../constants';
|
|
6
|
-
import { isConditionTrue } from '../if/if';
|
|
7
|
-
/** Check if an object is a condition */
|
|
8
|
-
function isCondition(condition) {
|
|
9
|
-
return condition && !!condition.operator;
|
|
10
|
-
}
|
|
11
|
-
// Assume the arg won't change from a variable to a condition
|
|
12
|
-
/* eslint-disable react-hooks/rules-of-hooks */
|
|
13
|
-
/** Accept a condition or variable object and extract the value from it */
|
|
14
|
-
function useConditionOrVariable(arg) {
|
|
15
|
-
if (isCondition(arg)) {
|
|
16
|
-
const value = useVariable(arg.variable)[0];
|
|
17
|
-
const other = useVariable(arg.other)[0];
|
|
18
|
-
return isConditionTrue(arg.operator, value, other);
|
|
19
|
-
}
|
|
20
|
-
return useVariable(arg)[0];
|
|
21
|
-
}
|
|
22
6
|
const StyledButton = injectCss(styled(UiButton) `
|
|
23
7
|
flex: ${(props) => (props.isSimpleButton ? undefined : '1 1 100%')};
|
|
24
8
|
`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../../js/common/button/button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAIH,UAAU,EACV,gBAAgB,EAGhB,OAAO,EACP,SAAS,EACT,SAAS,EACT,kBAAkB,EAClB,kBAAkB,EAClB,
|
|
1
|
+
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../../js/common/button/button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAIH,UAAU,EACV,gBAAgB,EAGhB,OAAO,EACP,SAAS,EACT,SAAS,EACT,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,GACzB,MAAM,cAAc,CAAC;AACtB,OAAO,MAAM,MAAM,2BAA2B,CAAC;AAC/C,OAAO,EAAE,MAAM,IAAI,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AA6B7C,MAAM,YAAY,GAAG,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAmB;YACtD,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC;CACrE,CAAC,CAAC;AAEH;;;;GAIG;AACH,SAAS,MAAM,CAAC,KAAkB;;IAC9B,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,kBAAkB,CAAC,KAAsC,CAAC,CAAC,CAAC,sFAAsF;IACvK,MAAM,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACzC,MAAM,OAAO,GAAG,kBAAkB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAClD,MAAM,QAAQ,GAAG,sBAAsB,CAAC,KAAK,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,EAAE,EAAE,CAAC,KAAC,gBAAgB,IAAC,SAAS,EAAE,KAAK,IAAO,UAAU,KAAK,CAAC,GAAG,EAAE,CAAI,CAAC,GACnF,IACX,CAClB,CAAC;AACN,CAAC;AAED,eAAe,MAAM,CAAC"}
|
package/dist/common/if/if.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentInstance, Condition,
|
|
1
|
+
import { ComponentInstance, Condition, StyledComponentProps } from '@darajs/core';
|
|
2
2
|
interface IfProps extends StyledComponentProps {
|
|
3
3
|
/** The condition def to evaluate */
|
|
4
4
|
condition: Condition<any>;
|
|
@@ -7,15 +7,6 @@ interface IfProps extends StyledComponentProps {
|
|
|
7
7
|
/** Children to render if the condition is true */
|
|
8
8
|
true_children: Array<ComponentInstance>;
|
|
9
9
|
}
|
|
10
|
-
/**
|
|
11
|
-
* This function takes the operator and both values and performs the appropriate comparison between the two and returns
|
|
12
|
-
* the result
|
|
13
|
-
*
|
|
14
|
-
* @param operator the operator defined in the condition
|
|
15
|
-
* @param value the value on the lhs of the condition
|
|
16
|
-
* @param other the value on the rhs of the condition
|
|
17
|
-
*/
|
|
18
|
-
export declare function isConditionTrue(operator: ConditionOperator, value: unknown, other: unknown): boolean;
|
|
19
10
|
/**
|
|
20
11
|
* The if component conditionally renders either the falsey or truthy children depending on the evaluation of the
|
|
21
12
|
* condition def object, with the values pulled from the recoil state
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"if.d.ts","sourceRoot":"","sources":["../../../js/common/if/if.tsx"],"names":[],"mappings":"AAEA,OAAO,EACH,iBAAiB,EACjB,SAAS,
|
|
1
|
+
{"version":3,"file":"if.d.ts","sourceRoot":"","sources":["../../../js/common/if/if.tsx"],"names":[],"mappings":"AAEA,OAAO,EACH,iBAAiB,EACjB,SAAS,EAET,oBAAoB,EAGvB,MAAM,cAAc,CAAC;AAEtB,UAAU,OAAQ,SAAQ,oBAAoB;IAC1C,oCAAoC;IACpC,SAAS,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC;IAC1B,mDAAmD;IACnD,cAAc,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACzC,kDAAkD;IAClD,aAAa,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC;CAC3C;AAED;;;;;GAKG;AACH,iBAAS,EAAE,CAAC,KAAK,EAAE,OAAO,GAAG,GAAG,CAAC,OAAO,CAmBvC;AAED,eAAe,EAAE,CAAC"}
|
package/dist/common/if/if.js
CHANGED
|
@@ -1,38 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
/**
|
|
5
|
-
* This function takes the operator and both values and performs the appropriate comparison between the two and returns
|
|
6
|
-
* the result
|
|
7
|
-
*
|
|
8
|
-
* @param operator the operator defined in the condition
|
|
9
|
-
* @param value the value on the lhs of the condition
|
|
10
|
-
* @param other the value on the rhs of the condition
|
|
11
|
-
*/
|
|
12
|
-
export function isConditionTrue(operator, value, other) {
|
|
13
|
-
if (operator === ConditionOperator.EQUAL) {
|
|
14
|
-
return value === other;
|
|
15
|
-
}
|
|
16
|
-
if (operator === ConditionOperator.NOT_EQUAL) {
|
|
17
|
-
return value !== other;
|
|
18
|
-
}
|
|
19
|
-
if (operator === ConditionOperator.GREATER_EQUAL) {
|
|
20
|
-
return value >= other;
|
|
21
|
-
}
|
|
22
|
-
if (operator === ConditionOperator.GREATER_THAN) {
|
|
23
|
-
return value > other;
|
|
24
|
-
}
|
|
25
|
-
if (operator === ConditionOperator.LESS_EQUAL) {
|
|
26
|
-
return value <= other;
|
|
27
|
-
}
|
|
28
|
-
if (operator === ConditionOperator.LESS_THAN) {
|
|
29
|
-
return value < other;
|
|
30
|
-
}
|
|
31
|
-
if (operator === ConditionOperator.TRUTHY) {
|
|
32
|
-
return !!value;
|
|
33
|
-
}
|
|
34
|
-
throw new Error(`Unexpected operator ${String(operator)} passed to conditional (If) component`);
|
|
35
|
-
}
|
|
3
|
+
import { DynamicComponent, isConditionTrue, useAnyVariable, } from '@darajs/core';
|
|
36
4
|
/**
|
|
37
5
|
* The if component conditionally renders either the falsey or truthy children depending on the evaluation of the
|
|
38
6
|
* condition def object, with the values pulled from the recoil state
|
package/dist/common/if/if.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"if.js","sourceRoot":"","sources":["../../../js/common/if/if.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAGH,
|
|
1
|
+
{"version":3,"file":"if.js","sourceRoot":"","sources":["../../../js/common/if/if.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAGH,gBAAgB,EAEhB,eAAe,EACf,cAAc,GACjB,MAAM,cAAc,CAAC;AAWtB;;;;;GAKG;AACH,SAAS,EAAE,CAAC,KAAc;IACtB,MAAM,KAAK,GAAG,cAAc,CAAC,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IACvD,MAAM,KAAK,GAAG,cAAc,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAEpD,MAAM,eAAe,GAAG,OAAO,CAC3B,GAAG,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC,SAAS,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAC,EAC7D,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,CAClC,CAAC;IACF,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,EAAE;QAC1B,OAAO,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC;IACxE,CAAC,EAAE,CAAC,eAAe,EAAE,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;IAEjE,OAAO,CACH,4BACK,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,CAC1B,KAAC,gBAAgB,IAAC,SAAS,EAAE,KAAK,IAAO,MAAM,GAAG,IAAI,KAAK,CAAC,IAAI,IAAI,MAAM,CAAC,eAAe,CAAC,EAAE,CAAI,CACpG,CAAC,GACH,CACN,CAAC;AACN,CAAC;AAED,eAAe,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../js/common/text/text.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAc,oBAAoB,EAAE,QAAQ,EAA8C,MAAM,cAAc,CAAC;AAGtH,UAAU,SAAU,SAAQ,oBAAoB;IAC5C,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;IAChC,SAAS,EAAE,OAAO,CAAC;CACtB;AAKD,iBAAS,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,GAAG,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../js/common/text/text.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAc,oBAAoB,EAAE,QAAQ,EAA8C,MAAM,cAAc,CAAC;AAGtH,UAAU,SAAU,SAAQ,oBAAoB;IAC5C,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;IAChC,SAAS,EAAE,OAAO,CAAC;CACtB;AAKD,iBAAS,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,GAAG,CAAC,OAAO,CAmD3C;AAED,eAAe,IAAI,CAAC"}
|
package/dist/common/text/text.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useContext } from 'react';
|
|
2
|
+
import { useContext, useMemo } from 'react';
|
|
3
3
|
import { DisplayCtx, injectCss, useComponentStyles, useVariable } from '@darajs/core';
|
|
4
4
|
import { useTheme } from '@darajs/styled-components';
|
|
5
5
|
const StyledSpan = injectCss('span');
|
|
@@ -13,11 +13,13 @@ function Text(props) {
|
|
|
13
13
|
const display_ctx = useContext(DisplayCtx);
|
|
14
14
|
// Add a default to the text color if it's not in a button or anchor
|
|
15
15
|
const color = ['anchor', 'button'].includes(display_ctx.component) ? props.color : props.color || theme.colors.text;
|
|
16
|
+
// In case an object is passed, just stringify it to display raw rather than crashing
|
|
17
|
+
const displayText = useMemo(() => (typeof text === 'string' ? text.trimEnd() : JSON.stringify(text)), [text]);
|
|
16
18
|
if (['anchor', 'paragraph'].includes(display_ctx.component)) {
|
|
17
|
-
return (_jsx(StyledSpan, { "$rawCss": css, className: props.className, style: Object.assign({ border: (_a = props === null || props === void 0 ? void 0 : props.border) !== null && _a !== void 0 ? _a : 'none', color, fontStyle: props.italic ? 'italic' : 'normal', fontWeight: props.bold ? 'bold' : 'normal', marginRight: '0.1em', textAlign: props.align, textDecoration: props.underline ? 'underline' : '' }, style), children:
|
|
19
|
+
return (_jsx(StyledSpan, { "$rawCss": css, className: props.className, style: Object.assign({ border: (_a = props === null || props === void 0 ? void 0 : props.border) !== null && _a !== void 0 ? _a : 'none', color, fontStyle: props.italic ? 'italic' : 'normal', fontWeight: props.bold ? 'bold' : 'normal', marginRight: '0.1em', textAlign: props.align, textDecoration: props.underline ? 'underline' : '' }, style), children: displayText }));
|
|
18
20
|
}
|
|
19
21
|
const tag = props.formatted ? 'pre' : 'div';
|
|
20
|
-
return (_jsx(StyledTag, { "$rawCss": css, as: tag, className: props.className, style: Object.assign({ color, margin: '0', textAlign: props.align }, style), children:
|
|
22
|
+
return (_jsx(StyledTag, { "$rawCss": css, as: tag, className: props.className, style: Object.assign({ color, margin: '0', textAlign: props.align }, style), children: displayText }));
|
|
21
23
|
}
|
|
22
24
|
export default Text;
|
|
23
25
|
//# sourceMappingURL=text.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.js","sourceRoot":"","sources":["../../../js/common/text/text.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"text.js","sourceRoot":"","sources":["../../../js/common/text/text.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAkC,SAAS,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACtH,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAWrD,MAAM,UAAU,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;AACrC,MAAM,SAAS,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;AAEnC,SAAS,IAAI,CAAC,KAAgB;;IAC1B,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAC/C,MAAM,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACvC,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IAEzB,2DAA2D;IAC3D,MAAM,WAAW,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;IAE3C,oEAAoE;IACpE,MAAM,KAAK,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAA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AAK,aAGX,WAAW,GACJ,CACf,CAAC;AACN,CAAC;AAED,eAAe,IAAI,CAAC"}
|
|
Binary file
|
|
@@ -50715,53 +50715,6 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
|
|
|
50715
50715
|
const tag2 = props.numbered ? "ol" : "ul";
|
|
50716
50716
|
return /* @__PURE__ */ React__default.default.createElement(StyledTag$2, { $rawCss: css2, as: tag2, style: style2 }, items.map((item, index2) => /* @__PURE__ */ React__default.default.createElement("li", { key: `li-${index2}`, style: { textAlign: "left" } }, item)));
|
|
50717
50717
|
}
|
|
50718
|
-
function isConditionTrue(operator2, value, other) {
|
|
50719
|
-
if (operator2 === core$1.ConditionOperator.EQUAL) {
|
|
50720
|
-
return value === other;
|
|
50721
|
-
}
|
|
50722
|
-
if (operator2 === core$1.ConditionOperator.NOT_EQUAL) {
|
|
50723
|
-
return value !== other;
|
|
50724
|
-
}
|
|
50725
|
-
if (operator2 === core$1.ConditionOperator.GREATER_EQUAL) {
|
|
50726
|
-
return value >= other;
|
|
50727
|
-
}
|
|
50728
|
-
if (operator2 === core$1.ConditionOperator.GREATER_THAN) {
|
|
50729
|
-
return value > other;
|
|
50730
|
-
}
|
|
50731
|
-
if (operator2 === core$1.ConditionOperator.LESS_EQUAL) {
|
|
50732
|
-
return value <= other;
|
|
50733
|
-
}
|
|
50734
|
-
if (operator2 === core$1.ConditionOperator.LESS_THAN) {
|
|
50735
|
-
return value < other;
|
|
50736
|
-
}
|
|
50737
|
-
if (operator2 === core$1.ConditionOperator.TRUTHY) {
|
|
50738
|
-
return !!value;
|
|
50739
|
-
}
|
|
50740
|
-
throw new Error(`Unexpected operator ${String(operator2)} passed to conditional (If) component`);
|
|
50741
|
-
}
|
|
50742
|
-
function If$1(props) {
|
|
50743
|
-
const value = core$1.useAnyVariable(props.condition.variable);
|
|
50744
|
-
const other = core$1.useAnyVariable(props.condition.other);
|
|
50745
|
-
const conditionResult = React.useMemo(
|
|
50746
|
-
() => isConditionTrue(props.condition.operator, value, other),
|
|
50747
|
-
[props.condition, value, other]
|
|
50748
|
-
);
|
|
50749
|
-
const children2 = React.useMemo(() => {
|
|
50750
|
-
return conditionResult ? props.true_children : props.false_children;
|
|
50751
|
-
}, [conditionResult, props.false_children, props.true_children]);
|
|
50752
|
-
return /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, children2.map((child, idx) => /* @__PURE__ */ React__default.default.createElement(core$1.DynamicComponent, { component: child, key: `if-${idx}-${child.name}-${String(conditionResult)}` })));
|
|
50753
|
-
}
|
|
50754
|
-
function isCondition(condition) {
|
|
50755
|
-
return condition && !!condition.operator;
|
|
50756
|
-
}
|
|
50757
|
-
function useConditionOrVariable(arg2) {
|
|
50758
|
-
if (isCondition(arg2)) {
|
|
50759
|
-
const value = core$1.useVariable(arg2.variable)[0];
|
|
50760
|
-
const other = core$1.useVariable(arg2.other)[0];
|
|
50761
|
-
return isConditionTrue(arg2.operator, value, other);
|
|
50762
|
-
}
|
|
50763
|
-
return core$1.useVariable(arg2)[0];
|
|
50764
|
-
}
|
|
50765
50718
|
const StyledButton$1 = core$1.injectCss(R__default.default(Button$3)`
|
|
50766
50719
|
flex: ${(props) => props.isSimpleButton ? void 0 : "1 1 100%"};
|
|
50767
50720
|
`);
|
|
@@ -50770,7 +50723,7 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
|
|
|
50770
50723
|
const [style2, css2] = core$1.useComponentStyles(props);
|
|
50771
50724
|
const onClick = core$1.useAction(props.onclick);
|
|
50772
50725
|
const loading = core$1.useActionIsLoading(props.onclick);
|
|
50773
|
-
const disabled2 = useConditionOrVariable(props.disabled);
|
|
50726
|
+
const disabled2 = core$1.useConditionOrVariable(props.disabled);
|
|
50774
50727
|
const Icon2 = props.icon ? core$1.getIcon(props.icon) : null;
|
|
50775
50728
|
const iconColor = Array.isArray(props.children) ? ((_c = (_b2 = (_a2 = props.children) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.props) == null ? void 0 : _c.color) || "inherit" : "inherit";
|
|
50776
50729
|
return /* @__PURE__ */ React__default.default.createElement(
|
|
@@ -51970,6 +51923,18 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
|
|
|
51970
51923
|
}
|
|
51971
51924
|
);
|
|
51972
51925
|
}
|
|
51926
|
+
function If$1(props) {
|
|
51927
|
+
const value = core$1.useAnyVariable(props.condition.variable);
|
|
51928
|
+
const other = core$1.useAnyVariable(props.condition.other);
|
|
51929
|
+
const conditionResult = React.useMemo(
|
|
51930
|
+
() => core$1.isConditionTrue(props.condition.operator, value, other),
|
|
51931
|
+
[props.condition, value, other]
|
|
51932
|
+
);
|
|
51933
|
+
const children2 = React.useMemo(() => {
|
|
51934
|
+
return conditionResult ? props.true_children : props.false_children;
|
|
51935
|
+
}, [conditionResult, props.false_children, props.true_children]);
|
|
51936
|
+
return /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, children2.map((child, idx) => /* @__PURE__ */ React__default.default.createElement(core$1.DynamicComponent, { component: child, key: `if-${idx}-${child.name}-${String(conditionResult)}` })));
|
|
51937
|
+
}
|
|
51973
51938
|
const ImageComponent = R__default.default.div`
|
|
51974
51939
|
display: flex;
|
|
51975
51940
|
`;
|
|
@@ -60284,6 +60249,7 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
|
|
|
60284
60249
|
const theme2 = useClTheme();
|
|
60285
60250
|
const display_ctx = React.useContext(core$1.DisplayCtx);
|
|
60286
60251
|
const color2 = ["anchor", "button"].includes(display_ctx.component) ? props.color : props.color || theme2.colors.text;
|
|
60252
|
+
const displayText = React.useMemo(() => typeof text2 === "string" ? text2.trimEnd() : JSON.stringify(text2), [text2]);
|
|
60287
60253
|
if (["anchor", "paragraph"].includes(display_ctx.component)) {
|
|
60288
60254
|
return /* @__PURE__ */ React__default.default.createElement(
|
|
60289
60255
|
StyledSpan,
|
|
@@ -60301,7 +60267,7 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
|
|
|
60301
60267
|
...style2
|
|
60302
60268
|
}
|
|
60303
60269
|
},
|
|
60304
|
-
|
|
60270
|
+
displayText
|
|
60305
60271
|
);
|
|
60306
60272
|
}
|
|
60307
60273
|
const tag2 = props.formatted ? "pre" : "div";
|
|
@@ -60318,7 +60284,7 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
|
|
|
60318
60284
|
...style2
|
|
60319
60285
|
}
|
|
60320
60286
|
},
|
|
60321
|
-
|
|
60287
|
+
displayText
|
|
60322
60288
|
);
|
|
60323
60289
|
}
|
|
60324
60290
|
const StyledTextarea = core$1.injectCss(TextArea);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@darajs/components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.17.0",
|
|
4
4
|
"description": "Components for the Dara framework",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"prettier": "@darajs/prettier-config",
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@babel/core": "^7.23.5",
|
|
32
|
-
"@darajs/eslint-config": "1.
|
|
33
|
-
"@darajs/prettier-config": "1.
|
|
34
|
-
"@darajs/stylelint-config": "1.
|
|
32
|
+
"@darajs/eslint-config": "1.17.0",
|
|
33
|
+
"@darajs/prettier-config": "1.17.0",
|
|
34
|
+
"@darajs/stylelint-config": "1.17.0",
|
|
35
35
|
"@testing-library/react-hooks": "^3.4.2",
|
|
36
36
|
"@types/lodash": "^4.14.155",
|
|
37
37
|
"@types/react": "18.2.60",
|
|
@@ -65,13 +65,13 @@
|
|
|
65
65
|
"@codemirror/state": "^6.0.0",
|
|
66
66
|
"@codemirror/theme-one-dark": "^6.1.2",
|
|
67
67
|
"@codemirror/view": "^6.0.0",
|
|
68
|
-
"@darajs/core": "1.
|
|
69
|
-
"@darajs/styled-components": "1.
|
|
70
|
-
"@darajs/ui-causal-graph-editor": "1.
|
|
71
|
-
"@darajs/ui-components": "1.
|
|
72
|
-
"@darajs/ui-hierarchy-viewer": "1.
|
|
73
|
-
"@darajs/ui-icons": "1.
|
|
74
|
-
"@darajs/ui-utils": "1.
|
|
68
|
+
"@darajs/core": "1.17.0",
|
|
69
|
+
"@darajs/styled-components": "1.17.0",
|
|
70
|
+
"@darajs/ui-causal-graph-editor": "1.17.0",
|
|
71
|
+
"@darajs/ui-components": "1.17.0",
|
|
72
|
+
"@darajs/ui-hierarchy-viewer": "1.17.0",
|
|
73
|
+
"@darajs/ui-icons": "1.17.0",
|
|
74
|
+
"@darajs/ui-utils": "1.17.0",
|
|
75
75
|
"@popperjs/core": "2.4.0",
|
|
76
76
|
"@vscode/codicons": "0.0.36",
|
|
77
77
|
"date-fns": "2.9.0",
|
|
@@ -96,5 +96,5 @@
|
|
|
96
96
|
"publishConfig": {
|
|
97
97
|
"access": "public"
|
|
98
98
|
},
|
|
99
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "61a6c4ab40ae91729f9ca075dc4821e00861315d"
|
|
100
100
|
}
|
|
Binary file
|