diginet-core-ui 1.3.93 → 1.3.94

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.
@@ -1,4 +1,7 @@
1
1
  /* eslint-disable no-undef */
2
+
3
+ import { getColor } from "./utils";
4
+
2
5
  /**
3
6
  * Returns a number whose value is limited to the given range.
4
7
  *
@@ -326,6 +329,7 @@ export const isColorName = color => {
326
329
  * @returns {string} color - rgba()
327
330
  */
328
331
  export const hexToRGBA = (hex, alpha) => {
332
+ hex = getColor(hex);
329
333
  if (isColorName(hex)) hex = isColorName(hex);
330
334
  if (!isColor(hex)) return;
331
335
  var r = parseInt(hex.slice(1, 3), 16),
package/styles/general.js CHANGED
@@ -2,6 +2,11 @@ import { css } from '@emotion/core';
2
2
  import { getColor, parseCSSValue, parseToPixel } from "./utils";
3
3
  export const rootSpacing = 4;
4
4
  export let rootZIndex = 1500;
5
+ export const alphaPseudo = {
6
+ hover: 0.1,
7
+ focus: 0.2,
8
+ active: 0.3
9
+ };
5
10
  export const typographyTypes = ['t1', 't2', 't3', 't4', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p1', 'p2', 'p3', 'title1', 'title2', 'title3', 'title4', 'heading1', 'heading2', 'heading3', 'heading4', 'heading5', 'heading6', 'paragraph1', 'paragraph2', 'paragraph3'];
6
11
 
7
12
  /**
@@ -59,6 +64,9 @@ const borderBottomColor = cl => css`
59
64
  const borderColor = cl => css`
60
65
  border-color: ${getColor(cl)};
61
66
  `;
67
+ const borderDashed = css`
68
+ border-style: dashed;
69
+ `;
62
70
  const borderNone = css`
63
71
  border: none;
64
72
  `;
@@ -226,6 +234,9 @@ const justifyStart = css`
226
234
  const left = vl => css`
227
235
  left: ${parseCSSValue(vl)};
228
236
  `;
237
+ const listNone = css`
238
+ list-style-type: none;
239
+ `;
229
240
  const mg = vl => css`
230
241
  margin: ${getSpacing(vl)};
231
242
  `;
@@ -453,4 +464,4 @@ const whiteSpacePreWrap = css`
453
464
  const z = vl => css`
454
465
  z-index: ${zIndex(vl)};
455
466
  `;
456
- export { bgColor, bgCurrent, bgTransparent, border, borderBottom, borderBottomColor, borderColor, borderNone, borderRadius, borderRadius100, borderRadius4px, borderRadius50, bottom, boxBorder, boxContent, breakAll, breakWord, cursorDefault, cursorInherit, cursorInitial, cursorMove, cursorNoDrop, cursorNotAllowed, cursorPointer, cursorText, displayBlock, displayFlex, displayInlineBlock, displayInlineFlex, displayNone, fill, flexCol, flexColReverse, flexNowrap, flexRow, flexRowReverse, flexShrink, flexShrink0, flexWrap, flexWrapReverse, floatLeft, floatNone, floatRight, gap, gapX, gapY, inset, insetX, insetY, invisible, italic, itemsCenter, itemsEnd, itemsStart, justifyAround, justifyBetween, justifyCenter, justifyEnd, justifyEvenly, justifyStart, left, mg, mgb, mgl, mgr, mgt, mgx, mgy, noBorder, noBoxShadow, noMargin, noPadding, objectContain, objectCover, objectFill, objectNone, order, outlineNone, overflowAuto, overflowHidden, parseHeight, parseMaxHeight, parseMaxWidth, parseMaxWidthHeight, parseMinHeight, parseMinWidth, parseMinWidthHeight, parseWidth, parseWidthHeight, pd, pdb, pdl, pdr, pdt, pdx, pdy, pointerEventsAuto, pointerEventsInherit, pointerEventsInitial, pointerEventsNone, positionAbsolute, positionFixed, positionRelative, positionSticky, right, scale, scaleX, scaleY, selfCenter, selfEnd, selfStart, shadowNone, textCapitalize, textCenter, textColor, textCurrent, textEllipsis, textLeft, textLineThrough, textLowercase, textRight, textSentence, textUnderline, textUppercase, top, truncate, userSelectNone, visible, whiteSpaceBreakSpaces, whiteSpaceNoWrap, whiteSpacePreWrap, z };
467
+ export { bgColor, bgCurrent, bgTransparent, border, borderBottom, borderBottomColor, borderColor, borderDashed, borderNone, borderRadius, borderRadius100, borderRadius4px, borderRadius50, bottom, boxBorder, boxContent, breakAll, breakWord, cursorDefault, cursorInherit, cursorInitial, cursorMove, cursorNoDrop, cursorNotAllowed, cursorPointer, cursorText, displayBlock, displayFlex, displayInlineBlock, displayInlineFlex, displayNone, fill, flexCol, flexColReverse, flexNowrap, flexRow, flexRowReverse, flexShrink, flexShrink0, flexWrap, flexWrapReverse, floatLeft, floatNone, floatRight, gap, gapX, gapY, inset, insetX, insetY, invisible, italic, itemsCenter, itemsEnd, itemsStart, justifyAround, justifyBetween, justifyCenter, justifyEnd, justifyEvenly, justifyStart, left, listNone, mg, mgb, mgl, mgr, mgt, mgx, mgy, noBorder, noBoxShadow, noMargin, noPadding, objectContain, objectCover, objectFill, objectNone, order, outlineNone, overflowAuto, overflowHidden, parseHeight, parseMaxHeight, parseMaxWidth, parseMaxWidthHeight, parseMinHeight, parseMinWidth, parseMinWidthHeight, parseWidth, parseWidthHeight, pd, pdb, pdl, pdr, pdt, pdx, pdy, pointerEventsAuto, pointerEventsInherit, pointerEventsInitial, pointerEventsNone, positionAbsolute, positionFixed, positionRelative, positionSticky, right, scale, scaleX, scaleY, selfCenter, selfEnd, selfStart, shadowNone, textCapitalize, textCenter, textColor, textCurrent, textEllipsis, textLeft, textLineThrough, textLowercase, textRight, textSentence, textUnderline, textUppercase, top, truncate, userSelectNone, visible, whiteSpaceBreakSpaces, whiteSpaceNoWrap, whiteSpacePreWrap, z };
package/styles/utils.js CHANGED
@@ -1,34 +1,34 @@
1
1
  import { color as colors } from "./colors";
2
2
 
3
- /**
4
- * Parse css value
5
- *
6
- * @param {string | number} vl
7
- * @returns {string | number}
3
+ /**
4
+ * Parse css value
5
+ *
6
+ * @param {string | number} vl
7
+ * @returns {string | number}
8
8
  */
9
9
  export const parseCSSValue = vl => {
10
10
  return isNaN(vl) ? vl : vl + 'px';
11
11
  };
12
12
 
13
- /**
14
- * Parse to pixel
15
- *
16
- * @param {number} vl
17
- * @returns {string}
13
+ /**
14
+ * Parse to pixel
15
+ *
16
+ * @param {number} vl
17
+ * @returns {string}
18
18
  */
19
19
  export const parseToPixel = vl => {
20
20
  if (!vl) return '1px';
21
21
  return typeof vl === 'string' ? vl : `${vl}px`;
22
22
  };
23
23
 
24
- /**
25
- * Get color from CORE colors
26
- *
27
- * @param {string} cl
28
- * @returns {string}
24
+ /**
25
+ * Get color from CORE colors
26
+ *
27
+ * @param {string} cl
28
+ * @returns {string}
29
29
  */
30
30
  export const getColor = cl => {
31
31
  if (typeof cl !== 'string') return;
32
32
  // example param cl: primary, info, system.rest, text.main, red, #333333,...
33
- return cl.split('.').reduce((p, c) => p && p[c] || null, colors) || cl;
33
+ return cl.split(/[./]/).reduce((p, c) => p && p[c] || null, colors) || cl;
34
34
  };
@@ -1,172 +0,0 @@
1
- import { css } from '@emotion/core';
2
- import theme from "../../theme/settings";
3
- import { itemsCenter, bgTransparent, boxBorder, borderRadius4px, breakWord, cursorPointer, displayInlineBlock, flexRow, flexRowReverse, displayInlineFlex, justifyBetween, justifyCenter, justifyEnd, parseWidthHeight, pointerEventsNone, positionAbsolute, positionRelative, userSelectNone } from "../../styles/general";
4
- const {
5
- colors: {
6
- system: {
7
- active,
8
- disabled: systemDisabled
9
- },
10
- fill: {
11
- disabled: fillDisabled,
12
- headerbar,
13
- focus,
14
- hover,
15
- pressed
16
- }
17
- },
18
- typography: {
19
- heading3
20
- },
21
- spacing
22
- } = theme;
23
- export const SummaryRootCSS = background => css`
24
- ${flexRow};
25
- ${positionRelative};
26
- ${justifyBetween};
27
- ${itemsCenter};
28
- ${cursorPointer};
29
- ${boxBorder};
30
- ${borderRadius4px};
31
- width: 100%;
32
- min-height: 56px;
33
- padding: ${spacing([4, 6])};
34
- ${background && `background-color: ${background === true ? headerbar : theme.colors[background] || background};`};
35
- .Accordion-Expand-Icon,
36
- .Accordion-Collapse-Icon {
37
- ${cursorPointer};
38
- color: ${active} !important;
39
- &:active,
40
- &:focus,
41
- &:hover {
42
- ${bgTransparent};
43
- color: ${active};
44
- }
45
- }
46
- .Accordion-Icon-Root {
47
- ${flexRow};
48
- .Accordion-Icon.rotate-able {
49
- ${boxBorder};
50
- ${parseWidthHeight(24, 24)};
51
- &:not(.TreeView) {
52
- transform: rotateZ(0deg);
53
- transform-origin: center;
54
- }
55
- &.TreeView {
56
- transform-origin: center;
57
- }
58
- }
59
- }
60
- &.start {
61
- ${flexRowReverse};
62
- ${justifyEnd};
63
- .Accordion-Icon.rotate-able {
64
- margin-right: ${spacing([2])};
65
- &.TreeView {
66
- transform: rotateZ(-90deg);
67
- }
68
- }
69
- }
70
- &.end {
71
- .Accordion-Icon.rotate-able {
72
- margin-left: ${spacing([2])};
73
- &.TreeView {
74
- transform: rotateZ(90deg);
75
- }
76
- }
77
- }
78
- &.expanding {
79
- border-radius: 4px 4px 0px 0px;
80
- .Accordion-Icon.rotate-able {
81
- &:not(.TreeView) {
82
- transform: rotateZ(90deg);
83
- }
84
- &.TreeView {
85
- transform: rotateZ(0deg);
86
- }
87
- }
88
- .Accordion-Icon:not(.rotate-able) {
89
- .Accordion-Expand-Icon {
90
- transform: scale(0);
91
- }
92
- .Accordion-Collapse-Icon {
93
- transform: scale(1);
94
- }
95
- }
96
- }
97
- &:not(.disabled) {
98
- transition: background-color 300ms ease;
99
- &:hover {
100
- background-color: ${hover};
101
- }
102
- &:focus {
103
- background-color: ${focus};
104
- }
105
- &:active {
106
- background-color: ${pressed};
107
- }
108
- }
109
- &.disabled {
110
- ${pointerEventsNone};
111
- background-color: ${fillDisabled};
112
- .DGN-UI-Accordion-Summary-Content,
113
- .Accordion-Expand-Icon {
114
- color: ${systemDisabled} !important;
115
- }
116
- }
117
- &.treeview-disabled {
118
- ${pointerEventsNone};
119
- &:hover {
120
- ${bgTransparent};
121
- }
122
- .TreeView-Item {
123
- color: ${systemDisabled};
124
- }
125
- .Accordion-Icon.rotate-able.TreeView .DGN-UI-Icon {
126
- ${cursorPointer};
127
- pointer-events: initial;
128
- }
129
- }
130
- .DGN-UI-Accordion-Summary-Content {
131
- ${heading3};
132
- ${flexRow};
133
- ${positionRelative};
134
- ${breakWord};
135
- ${userSelectNone};
136
- ${boxBorder}
137
- ${itemsCenter};
138
- color: ${active};
139
- width: 100%;
140
- min-height: 24px;
141
- }
142
- .Accordion-Icon {
143
- ${displayInlineBlock};
144
- ${positionRelative};
145
- ${cursorPointer};
146
- ${parseWidthHeight(24, 24)};
147
- transition: transform 200ms linear;
148
- .Accordion-Expand-Icon {
149
- transform: scale(1);
150
- transition: transform 200ms linear;
151
- &.effect {
152
- ${positionRelative};
153
- }
154
- }
155
- .Accordion-Collapse-Icon {
156
- ${positionAbsolute};
157
- inset: 0;
158
- transform: scale(0);
159
- transition: transform 200ms linear;
160
- }
161
- .effect {
162
- ${displayInlineFlex};
163
- ${justifyCenter};
164
- ${itemsCenter};
165
- ${cursorPointer};
166
- min-width: 24px;
167
- max-width: 34px;
168
- min-height: 24px;
169
- max-height: 34px;
170
- }
171
- }
172
- `;