ag-common 0.0.264 → 0.0.267

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.
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Icon = exports.IconF = void 0;
7
7
  const common_1 = require("../../styles/common");
8
+ const object_1 = require("../../../common/helpers/object");
8
9
  const react_1 = __importDefault(require("react"));
9
10
  const styled_components_1 = __importDefault(require("styled-components"));
10
11
  exports.IconF = styled_components_1.default.span `
@@ -25,18 +26,22 @@ exports.IconF = styled_components_1.default.span `
25
26
  flex-grow: 1;
26
27
  }
27
28
 
28
- fill: var(--fill);
29
-
30
- svg {
29
+ &[data-hasfill='true'] {
31
30
  fill: var(--fill);
32
- }
33
31
 
34
- linearGradient > *,
35
- radialGradient > * {
36
- stop-color: var(--fill) !important;
32
+ svg {
33
+ fill: var(--fill);
34
+ }
35
+
36
+ linearGradient > *,
37
+ radialGradient > * {
38
+ stop-color: var(--fill) !important;
39
+ }
37
40
  }
38
41
 
39
- ${common_1.HardOutline}
42
+ &[data-hasoutline='true'] {
43
+ ${common_1.HardOutline}
44
+ }
40
45
 
41
46
  svg {
42
47
  width: 100%;
@@ -46,16 +51,16 @@ exports.IconF = styled_components_1.default.span `
46
51
  const Icon = (pr) => {
47
52
  const { className, children, disabled, onClick } = pr;
48
53
  const CHND = pr.canHover && !pr.disabled;
49
- const style = {
50
- '--fill': pr.fill || '',
54
+ const style = (0, object_1.removeUndefValuesFromObject)({
55
+ '--fill': pr.fill || null,
51
56
  width: pr.width || '100%',
52
57
  height: pr.height || '100%',
53
58
  padding: pr.padding || '0',
54
59
  margin: pr.margin || 'unset',
55
- transform: !pr.rotate ? '' : `rotate(${pr.rotate || 0}deg)`,
56
- filter: !pr.disabled ? '' : 'grayscale(1)',
57
- '--outlinecolour': pr.outline || '',
58
- };
59
- return (react_1.default.createElement(exports.IconF, Object.assign({}, pr, { className: className, onClick: (e) => !disabled && (onClick === null || onClick === void 0 ? void 0 : onClick(e)), style: style, "data-chnd": CHND }), children));
60
+ transform: !pr.rotate ? null : `rotate(${pr.rotate || 0}deg)`,
61
+ filter: !pr.disabled ? null : 'grayscale(1)',
62
+ '--outlinecolour': pr.outline || null,
63
+ });
64
+ return (react_1.default.createElement(exports.IconF, Object.assign({}, pr, { className: className, onClick: (e) => !disabled && (onClick === null || onClick === void 0 ? void 0 : onClick(e)), style: style, "data-chnd": CHND, "data-hasoutline": pr.outline, "data-hasfill": !!pr.fill }), children));
60
65
  };
61
66
  exports.Icon = Icon;
@@ -56,7 +56,7 @@ const Content = styled_components_1.default.div `
56
56
  &[data-open='false'] {
57
57
  padding: 1rem;
58
58
  background-color: white;
59
- ${(0, common_1.Shadow)()};
59
+ filter: drop-shadow(1px 1px 0.5rem #555);
60
60
  border-radius: 1rem;
61
61
  }
62
62
  `;
@@ -82,7 +82,6 @@ const Hamburger = styled_components_1.default.div `
82
82
  }
83
83
  border-radius: 50%;
84
84
  border: solid 1px rgba(0, 0, 0, 0.5);
85
-
86
85
  cursor: pointer;
87
86
  `;
88
87
  const ChevronStyled = (0, styled_components_1.default)(Chevron_1.Chevron) `
@@ -102,7 +102,9 @@ const TextEdit = ({ defaultValue = '', defaultEditing, disableEdit = false, plac
102
102
  if (!disableEdit && editing && defaultEditing) {
103
103
  return;
104
104
  }
105
- setEditingRaw(false);
105
+ if (editing) {
106
+ setEditingRaw(false);
107
+ }
106
108
  }
107
109
  });
108
110
  const setEditing = (0, react_1.useCallback)((b) => {
@@ -1,6 +1,5 @@
1
1
  /// <reference types="react" />
2
- export declare const HardOutline = "\n filter: drop-shadow(1px 1px 0px var(--outlinecolour)) drop-shadow(-1px 1px 0px var(--outlinecolour))\n drop-shadow(1px -1px 0px var(--outlinecolour)) drop-shadow(-1px -1px 0px var(--outlinecolour));\n";
3
- export declare const Shadow: (colour?: string) => import("styled-components").FlattenSimpleInterpolation;
2
+ export declare const HardOutline: import("styled-components").FlattenSimpleInterpolation;
4
3
  export declare const NoTextSelect: import("styled-components").FlattenSimpleInterpolation;
5
4
  export declare const TextOverflowEllipsis: import("styled-components").FlattenSimpleInterpolation;
6
5
  export declare const CssTransparentBlock: import("styled-components").FlattenSimpleInterpolation;
@@ -23,21 +23,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.bounce = exports.FullScreenPage = exports.noDrag = exports.Card = exports.FadeBottom = exports.CssTransparentBlock = exports.TextOverflowEllipsis = exports.NoTextSelect = exports.Shadow = exports.HardOutline = void 0;
26
+ exports.bounce = exports.FullScreenPage = exports.noDrag = exports.Card = exports.FadeBottom = exports.CssTransparentBlock = exports.TextOverflowEllipsis = exports.NoTextSelect = exports.HardOutline = void 0;
27
27
  const colours_1 = require("./colours");
28
28
  const styled_components_1 = __importStar(require("styled-components"));
29
- exports.HardOutline = `
30
- filter: drop-shadow(1px 1px 0px var(--outlinecolour)) drop-shadow(-1px 1px 0px var(--outlinecolour))
31
- drop-shadow(1px -1px 0px var(--outlinecolour)) drop-shadow(-1px -1px 0px var(--outlinecolour));
29
+ exports.HardOutline = (0, styled_components_1.css) `
30
+ filter: drop-shadow(1px 1px 0px var(--outlinecolour))
31
+ drop-shadow(-1px 1px 0px var(--outlinecolour))
32
+ drop-shadow(1px -1px 0px var(--outlinecolour))
33
+ drop-shadow(-1px -1px 0px var(--outlinecolour));
32
34
  `;
33
- const Shadow = (
34
- /**
35
- * colour of shadow, default #555
36
- */
37
- colour = '#555') => (0, styled_components_1.css) `
38
- filter: drop-shadow(1px 1px 0.5rem ${colour});
39
- `;
40
- exports.Shadow = Shadow;
41
35
  exports.NoTextSelect = (0, styled_components_1.css) `
42
36
  user-select: none; /* supported by Chrome and Opera */
43
37
  -webkit-user-select: none; /* Safari */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ag-common",
3
- "version": "0.0.264",
3
+ "version": "0.0.267",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "author": "Andrei Gec <@andreigec> (https://gec.dev/)",