@elliemae/ds-system 3.80.0-next.8 → 3.80.0-next.80
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/index.js +1 -0
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/lockedStateCss.js +62 -0
- package/dist/cjs/lockedStateCss.js.map +7 -0
- package/dist/cjs/styled/Documentation.md +17 -18
- package/dist/cjs/utils.js.map +2 -2
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/lockedStateCss.js +32 -0
- package/dist/esm/lockedStateCss.js.map +7 -0
- package/dist/esm/styled/Documentation.md +17 -18
- package/dist/esm/utils.js.map +2 -2
- package/dist/types/index.d.ts +1 -0
- package/dist/types/lockedStateCss.d.ts +21 -0
- package/dist/types/utils.d.ts +8 -0
- package/dist/types/xStyledWrapper.d.ts +1 -1
- package/package.json +4 -4
package/dist/cjs/index.js
CHANGED
|
@@ -102,6 +102,7 @@ var import_system = require("@xstyled/system");
|
|
|
102
102
|
var import_HtmlComponents = require("./HtmlComponents.js");
|
|
103
103
|
__reExport(index_exports, require("./arithmetic.js"), module.exports);
|
|
104
104
|
__reExport(index_exports, require("./globalStyles.js"), module.exports);
|
|
105
|
+
__reExport(index_exports, require("./lockedStateCss.js"), module.exports);
|
|
105
106
|
__reExport(index_exports, require("./mergeRefs.js"), module.exports);
|
|
106
107
|
__reExport(index_exports, require("./mobileUtilities.js"), module.exports);
|
|
107
108
|
__reExport(index_exports, require("./spaceUtilities.js"), module.exports);
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["export { ThemeContext } from '@xstyled/styled-components';\nexport { position, typography } from '@xstyled/system';\nexport {\n A,\n Abbr,\n Address,\n Article,\n Aside,\n B,\n Bdi,\n Bdo,\n Blockquote,\n Br,\n Cite,\n Code,\n Data,\n Dd,\n Dfn,\n Div,\n Dl,\n Dt,\n Em,\n Figcaption,\n Figure,\n Footer,\n H1,\n H2,\n H3,\n H4,\n H5,\n H6,\n Header,\n Hgroup,\n Hr,\n I,\n Kbd,\n Li,\n Main,\n Mark,\n Menu,\n Nav,\n Ol,\n P,\n Pre,\n Q,\n Rp,\n Rt,\n Ruby,\n S,\n Samp,\n Search,\n Section,\n Small,\n Span,\n Strong,\n Sub,\n Sup,\n Time,\n U,\n Ul,\n Wbr,\n} from './HtmlComponents.js';\nexport * from './arithmetic.js';\nexport * from './globalStyles.js';\nexport * from './mergeRefs.js';\nexport * from './mobileUtilities.js';\nexport * from './spaceUtilities.js';\nexport * from './styled/index.js';\nexport * from './th.js';\nexport * from './theme.js';\nexport { themeProviderHOC } from './themeProviderHOC.js';\nexport * from './utils.js';\nexport { XStyledWrapper, xStyledCommonProps } from './xStyledWrapper.js';\n// styled components uses csstype types internally but doesn't solve the types export correctly\n// so to fix ts2742 we need to re-export the types from csstype...\nexport type * from 'csstype';\nexport { useGetLayoutMode } from './useGetLayoutMode.js';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,+BAA6B;AAC7B,oBAAqC;AACrC,4BA2DO;AACP,0BAAc,4BA9Dd;AA+DA,0BAAc,8BA/Dd;AAgEA,0BAAc,
|
|
4
|
+
"sourcesContent": ["export { ThemeContext } from '@xstyled/styled-components';\nexport { position, typography } from '@xstyled/system';\nexport {\n A,\n Abbr,\n Address,\n Article,\n Aside,\n B,\n Bdi,\n Bdo,\n Blockquote,\n Br,\n Cite,\n Code,\n Data,\n Dd,\n Dfn,\n Div,\n Dl,\n Dt,\n Em,\n Figcaption,\n Figure,\n Footer,\n H1,\n H2,\n H3,\n H4,\n H5,\n H6,\n Header,\n Hgroup,\n Hr,\n I,\n Kbd,\n Li,\n Main,\n Mark,\n Menu,\n Nav,\n Ol,\n P,\n Pre,\n Q,\n Rp,\n Rt,\n Ruby,\n S,\n Samp,\n Search,\n Section,\n Small,\n Span,\n Strong,\n Sub,\n Sup,\n Time,\n U,\n Ul,\n Wbr,\n} from './HtmlComponents.js';\nexport * from './arithmetic.js';\nexport * from './globalStyles.js';\nexport * from './lockedStateCss.js';\nexport * from './mergeRefs.js';\nexport * from './mobileUtilities.js';\nexport * from './spaceUtilities.js';\nexport * from './styled/index.js';\nexport * from './th.js';\nexport * from './theme.js';\nexport { themeProviderHOC } from './themeProviderHOC.js';\nexport * from './utils.js';\nexport { XStyledWrapper, xStyledCommonProps } from './xStyledWrapper.js';\n// styled components uses csstype types internally but doesn't solve the types export correctly\n// so to fix ts2742 we need to re-export the types from csstype...\nexport type * from 'csstype';\nexport { useGetLayoutMode } from './useGetLayoutMode.js';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,+BAA6B;AAC7B,oBAAqC;AACrC,4BA2DO;AACP,0BAAc,4BA9Dd;AA+DA,0BAAc,8BA/Dd;AAgEA,0BAAc,gCAhEd;AAiEA,0BAAc,2BAjEd;AAkEA,0BAAc,iCAlEd;AAmEA,0BAAc,gCAnEd;AAoEA,0BAAc,8BApEd;AAqEA,0BAAc,oBArEd;AAsEA,0BAAc,uBAtEd;AAuEA,8BAAiC;AACjC,0BAAc,uBAxEd;AAyEA,4BAAmD;AAInD,8BAAiC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var lockedStateCss_exports = {};
|
|
30
|
+
__export(lockedStateCss_exports, {
|
|
31
|
+
ariaDisabledInteractionCss: () => ariaDisabledInteractionCss,
|
|
32
|
+
disabledInteractionCss: () => disabledInteractionCss,
|
|
33
|
+
lockedStateInteractionCss: () => lockedStateInteractionCss
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(lockedStateCss_exports);
|
|
36
|
+
var React = __toESM(require("react"));
|
|
37
|
+
var import_styled_components = require("@xstyled/styled-components");
|
|
38
|
+
const disabledInteractionCss = import_styled_components.css`
|
|
39
|
+
cursor: not-allowed;
|
|
40
|
+
`;
|
|
41
|
+
const ariaDisabledInteractionCss = import_styled_components.css`
|
|
42
|
+
cursor: not-allowed;
|
|
43
|
+
`;
|
|
44
|
+
const lockedStateInteractionCss = import_styled_components.css`
|
|
45
|
+
${({ $disabled }) => $disabled && import_styled_components.css`
|
|
46
|
+
&& {
|
|
47
|
+
${disabledInteractionCss}
|
|
48
|
+
}
|
|
49
|
+
`}
|
|
50
|
+
${({ $disabled, $applyAriaDisabled, $readOnly }) => !$disabled && ($applyAriaDisabled || $readOnly) && import_styled_components.css`
|
|
51
|
+
&& {
|
|
52
|
+
${ariaDisabledInteractionCss}
|
|
53
|
+
}
|
|
54
|
+
`}
|
|
55
|
+
&&:disabled {
|
|
56
|
+
${disabledInteractionCss}
|
|
57
|
+
}
|
|
58
|
+
&&[aria-disabled='true'] {
|
|
59
|
+
${ariaDisabledInteractionCss}
|
|
60
|
+
}
|
|
61
|
+
`;
|
|
62
|
+
//# sourceMappingURL=lockedStateCss.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/lockedStateCss.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { css } from '@xstyled/styled-components';\n\n// Shared interaction styles of the three lock states (PUI-16695). Colours, borders and backgrounds stay per component:\n// only what the three states have in common lives here.\n// - disabled (hard lock): the only CSS is a not-allowed cursor. Pointer events are not touched, so the element stays\n// hit-testable and paints its own cursor.\n// - applyAriaDisabled / readOnly (soft locks, synonyms): the same not-allowed cursor. Focus and hover stay live.\n// Stopping the actions is not CSS's job, in either state. It is JavaScript: the shared helpers `omitLockedHandlers` and\n// `isLocked` from `@elliemae/ds-props-helpers`, and each component's own gates. A locked element can still receive a\n// click or a key, and the handler gate is what keeps the consumer callback from running.\n// Hover and active styles of a hard-locked element are not handled here. Each component guards its own `:hover` and\n// `:active` rules against the lock (`:not(:disabled)`, `!$disabled &&`, ...).\n//\n// Two ways to reach the same result, both handled by `lockedStateInteractionCss`:\n// 1. transient props (`$disabled`, `$applyAriaDisabled`, `$readOnly`): for elements that cannot express the state in\n// the DOM by themselves. styled-components never forwards `$` props, so a non-native element never prints a\n// meaningless `disabled=\"\"`. `$disabled` is the only way to say \"hard lock\" on a non-native element, because there a\n// disabled falls back to `aria-disabled=\"true\"`, which is indistinguishable from applyAriaDisabled in the DOM.\n// 2. DOM selectors (`:disabled`, `[aria-disabled='true']`): for native controls and for anything that already prints\n// the state. The styles then read the same DOM the screen reader sees, so they cannot drift from it.\n// Specificity: the DOM-selector rules (`&&:disabled`, `&&[aria-disabled='true']`) are (0,3,0) and beat a component's own\n// `&:hover { cursor: ... }` whatever the source order is. The transient-prop rules use `&&` (0,2,0): they tie with a\n// component's own `&:hover`, so place `lockedStateInteractionCss` AFTER the component's hover rules and the lock wins.\n\nexport type LockedStateStyleProps = {\n $disabled?: boolean;\n $applyAriaDisabled?: boolean;\n $readOnly?: boolean;\n};\n\n/**\n * `disabled` (hard lock) interaction: a not-allowed cursor and nothing else. The element keeps its pointer events, so\n * it paints the cursor itself. The actions are stopped in JavaScript.\n */\nexport const disabledInteractionCss = css`\n cursor: not-allowed;\n`;\n\n/**\n * `applyAriaDisabled` / `readOnly` (soft lock) interaction: a not-allowed cursor. Hover and focus stay live, and the\n * component ignores the actions in JavaScript.\n */\nexport const ariaDisabledInteractionCss = css`\n cursor: not-allowed;\n`;\n\n/**\n * Drop-in for a styled template: `${lockedStateInteractionCss}`.\n * Reads `$disabled`, `$applyAriaDisabled`, `$readOnly` and the DOM (`:disabled`, `[aria-disabled='true']`).\n * Put it in the same template as the component's own states; its selectors win by specificity, not by order.\n */\nexport const lockedStateInteractionCss = css<LockedStateStyleProps>`\n ${({ $disabled }) =>\n $disabled &&\n css`\n && {\n ${disabledInteractionCss}\n }\n `}\n ${({ $disabled, $applyAriaDisabled, $readOnly }) =>\n !$disabled &&\n ($applyAriaDisabled || $readOnly) &&\n css`\n && {\n ${ariaDisabledInteractionCss}\n }\n `}\n &&:disabled {\n ${disabledInteractionCss}\n }\n &&[aria-disabled='true'] {\n ${ariaDisabledInteractionCss}\n }\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,+BAAoB;AAkCb,MAAM,yBAAyB;AAAA;AAAA;AAQ/B,MAAM,6BAA6B;AAAA;AAAA;AASnC,MAAM,4BAA4B;AAAA,IACrC,CAAC,EAAE,UAAU,MACb,aACA;AAAA;AAAA,UAEM,sBAAsB;AAAA;AAAA,KAE3B;AAAA,IACD,CAAC,EAAE,WAAW,oBAAoB,UAAU,MAC5C,CAAC,cACA,sBAAsB,cACvB;AAAA;AAAA,UAEM,0BAA0B;AAAA;AAAA,KAE/B;AAAA;AAAA,MAEC,sBAAsB;AAAA;AAAA;AAAA,MAGtB,0BAA0B;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
This document delves into the internal mechanics of our custom styled-component wrapper, providing insights for developers who need to understand or extend its functionality.
|
|
4
4
|
|
|
5
5
|
#### Overview
|
|
6
|
+
|
|
6
7
|
The wrapper is designed to extend the standard functionality of styled-components with additional features like automatic theme coercion, design system integration, and automatic attribute generation. It acts as a higher-order component (HOC) that wraps around the base styled component.
|
|
7
8
|
|
|
8
9
|
#### Understanding Tagged Template Literals
|
|
10
|
+
|
|
9
11
|
In standard styled-components usage, styled components are often defined using tagged template literals, a feature of ES6. For example:
|
|
10
12
|
|
|
11
13
|
```typescript
|
|
@@ -19,7 +21,7 @@ This syntax is concise and readable, especially for defining component styles th
|
|
|
19
21
|
But, for the purpose of this document, you should understand the real way this gets "transpiled" to:
|
|
20
22
|
|
|
21
23
|
```typescript
|
|
22
|
-
styled('button')(['margin: ', ';\n'], ({theme}) => theme.space.xs);
|
|
24
|
+
styled('button')(['margin: ', ';\n'], ({ theme }) => theme.space.xs);
|
|
23
25
|
```
|
|
24
26
|
|
|
25
27
|
So, `styled` is a function that takes a tag (in this case, `'button'`) and returns a function that takes any number of arguments. The first argument is an array of strings (the constant parts of the template literal), and the rest are the interpolated values (the dynamic parts of the template literal). Each interpolated value will be inserted into the array of strings at the corresponding index.
|
|
@@ -74,10 +76,10 @@ return Object.assign(dsStyledResolver, styledAttributes);
|
|
|
74
76
|
It looks scary. But let's break it down.
|
|
75
77
|
|
|
76
78
|
1. We create a base styled resolver using the `baseStyled` function. This is just calling the ORIGINAL `styled` function from `styled-components` (we just changed its name when importing it).
|
|
77
|
-
Ultimately, this is the function that will be called when we use our styled component, since we are just building a wrapper of it.
|
|
79
|
+
Ultimately, this is the function that will be called when we use our styled component, since we are just building a wrapper of it.
|
|
78
80
|
|
|
79
81
|
2. We create a new resolver, `dsStyledResolver`, that will be the one that will be returned by our wrapper. It has to receive as a first argument the styleArg, which is the style object or string that we pass to the styled component. The rest of the arguments are the interpolated values of the tagged template literal.
|
|
80
|
-
This function will do a lot of magic, but it will ultimately call the `baseStyledResolver` with the correct arguments.
|
|
82
|
+
This function will do a lot of magic, but it will ultimately call the `baseStyledResolver` with the correct arguments.
|
|
81
83
|
|
|
82
84
|
3. We create an object with two methods, `attrs` and `withConfig`, that will be used to augment the styled component. These methods are just calling the original methods of the `baseStyledResolver`, and then returning the `dsStyledResolver` itself. This is just to make sure that the styled component is augmented with the correct methods.
|
|
83
85
|
|
|
@@ -95,9 +97,9 @@ Well, this function is needed for something we do later in the code, but the bas
|
|
|
95
97
|
|
|
96
98
|
```typescript
|
|
97
99
|
const StyledChat = styled('div')`
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
${StyledChatBubble} {
|
|
101
|
+
margin: 0;
|
|
102
|
+
}
|
|
101
103
|
`;
|
|
102
104
|
```
|
|
103
105
|
|
|
@@ -110,20 +112,20 @@ The `dsStyledComponentTransform` function will transform the styled component in
|
|
|
110
112
|
So basically it will transform `StyledChatBubble`
|
|
111
113
|
|
|
112
114
|
```typescript
|
|
113
|
-
`.${StyledChatBubble.dsStyledComponentId}
|
|
115
|
+
`.${StyledChatBubble.dsStyledComponentId}`;
|
|
114
116
|
```
|
|
115
117
|
|
|
116
118
|
Notice the `.` before the interpolation. This is because we are interpolating a class name, and we need to add the `.` to make it a valid CSS selector.
|
|
117
119
|
|
|
118
120
|
```typescript
|
|
119
|
-
|
|
121
|
+
const [styleArgWithMagic, expressionsWithMagic] = magicCssTransform(styleArg, expressionsWithDsStyledComponentId);
|
|
120
122
|
```
|
|
121
123
|
|
|
122
124
|
This transformation allows our styled components to be MAGICAL. Meaning, we support things like this:
|
|
123
125
|
|
|
124
126
|
```typescript
|
|
125
127
|
const StyledButton = styled('button')`
|
|
126
|
-
|
|
128
|
+
color: neutral-100;
|
|
127
129
|
`;
|
|
128
130
|
```
|
|
129
131
|
|
|
@@ -135,7 +137,7 @@ Then we need to replace that token with the corresponding value from the theme,
|
|
|
135
137
|
|
|
136
138
|
```typescript
|
|
137
139
|
const StyledButton = styled('button')`
|
|
138
|
-
|
|
140
|
+
color: ${({ theme }) => theme.colors.neutral[100]};
|
|
139
141
|
`;
|
|
140
142
|
```
|
|
141
143
|
|
|
@@ -163,16 +165,15 @@ expresions = [f1, f2, f3]
|
|
|
163
165
|
expressions = [({theme,...rest}) => f1({...rest, theme: theme ?? defaultTheme}), ...]
|
|
164
166
|
```
|
|
165
167
|
|
|
166
|
-
|
|
167
168
|
Let's look at the next important part
|
|
168
169
|
|
|
169
170
|
```typescript
|
|
170
171
|
if (componentName && componentSlot) {
|
|
171
|
-
|
|
172
|
+
expressionsWithThemeCoerced.push(genStyleOverridesExpression(componentName, componentSlot));
|
|
172
173
|
}
|
|
173
174
|
|
|
174
175
|
if (componentName && componentSlot === 'root') {
|
|
175
|
-
|
|
176
|
+
expressionsWithThemeCoerced.push(genVariantOverridesExpression(componentName));
|
|
176
177
|
}
|
|
177
178
|
|
|
178
179
|
const numOfExpressionsAdded = expressionsWithThemeCoerced.length - expressionsWithMagic.length;
|
|
@@ -186,15 +187,14 @@ Notice that we are adding the expressions at the end of the array, so they will
|
|
|
186
187
|
|
|
187
188
|
It's also important to note that we need to fix the styleArg after adding the expressions, since we added new expressions, and we need to adjust the styleArg to match the new expressions array.
|
|
188
189
|
|
|
189
|
-
|
|
190
190
|
In the next part, we just generate some autocalculated values, like display name, data-testids, classNames, etc. And then, we just add them one by one by using the `attrs` function
|
|
191
191
|
|
|
192
192
|
```typescript
|
|
193
193
|
const [displayName, attributes] = generateAutoCalculated(options);
|
|
194
194
|
|
|
195
195
|
const baseStyledResolverWithAttributes = attributes.reduce<typeof baseStyledResolver>(
|
|
196
|
-
|
|
197
|
-
|
|
196
|
+
(curStyledResolver, attributeFunc) => curStyledResolver.attrs(attributeFunc),
|
|
197
|
+
baseStyledResolver,
|
|
198
198
|
);
|
|
199
199
|
```
|
|
200
200
|
|
|
@@ -209,7 +209,6 @@ So, wrapper ONLY augments the styleArg and expressions, and then calls the origi
|
|
|
209
209
|
|
|
210
210
|
There is an extra piece of logic after this, which is creating a wrapper for this component that automatically merges refs, puts global attributes, etc.
|
|
211
211
|
|
|
212
|
-
|
|
213
212
|
```typescript
|
|
214
213
|
const ComponentWithRefsMerged = (props: OwnerInterface & InnerRefInterface<C> & { 'data-testid'?: string }) => {
|
|
215
214
|
// we may or not have data-testid at this point, so we need to calculate it
|
|
@@ -249,4 +248,4 @@ We need to add the `dsStyledComponentId` and `toString` to the wrapper, so we ca
|
|
|
249
248
|
```typescript
|
|
250
249
|
ComponentWithRefsMerged.dsStyledComponentId = Component.styledComponentId as string;
|
|
251
250
|
ComponentWithRefsMerged.toString = Component.toString;
|
|
252
|
-
```
|
|
251
|
+
```
|
package/dist/cjs/utils.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-unsafe-return */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable no-shadow */\n/* eslint-disable max-lines */\n/* eslint-disable @typescript-eslint/no-shadow */\n\n// https://github.com/styled-components/babel-plugin-styled-components/issues/216#issuecomment-516941240\n\nimport type { Theme } from '@elliemae/pui-theme';\nimport { reduce } from 'lodash-es';\nimport type { Keyframes, FlattenSimpleInterpolation } from 'styled-components';\nimport { css, withTheme, keyframes as kfrm, useTheme } from '@xstyled/styled-components';\nimport { theme } from './theme.js';\nimport { toMobile } from './mobileUtilities.js';\nimport { th } from './th.js';\n\nexport { withTheme, useTheme, kfrm };\n\ntype PropsWithTheme<T = Record<string, unknown>> = T & { theme: Theme };\n\nexport function truncate(width?: string) {\n return (props: PropsWithTheme<{ width?: string }>) => css`\n ${!!width || props.width ? `width: ${(props.width || width) as string};` : ''}\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n `;\n}\n\nexport function flexCenter(): string {\n return `\n display: flex;\n justify-content: center;\n align-items: center;\n `;\n}\n\nexport function disabled(): string {\n return `\n cursor: not-allowed;\n pointer-events: none;\n `;\n}\n\nexport function keyframes(obj: Record<string, string>): Keyframes {\n return kfrm`${reduce(\n obj,\n (result, value, key) => `\n ${result}\n ${key}% {\n ${value}\n }\n `,\n '',\n )}\n `;\n}\n\n// eslint-disable-next-line max-params\nexport function boxShadow(top: string, left: string, blur: string, color: string, inset = false): string {\n return `box-shadow: ${inset ? 'inset' : ''} ${top} ${left} ${blur} ${color};`;\n}\n\n// export function color(variant = 'neutral', type: string | number = 400) {\n// return css`\n// color: ${th.color(`${variant}-${type}`)};\n// `;\n// }\n\nexport function border(color = theme.colors.brand[600], size = '1px', type = 'solid'): string {\n return `${size} ${type} ${color}`;\n}\n\nexport function animation(animationKeyframes: string, animationLength: string, animationTimingFn: string) {\n return (props: { animationKeyframes?: string; animationLength?: string; animationTimingFn?: string }) => css`\n animation: ${props.animationKeyframes || animationKeyframes} ${props.animationLength || animationLength}\n ${props.animationTimingFn || animationTimingFn};\n `;\n}\n\nexport function active() {\n return (props: PropsWithTheme) => css`\n outline: none;\n border: 1px solid ${props.theme.colors.brand[700]};\n border-radius: 2px;\n `;\n}\n\nexport function hover() {\n return (props: PropsWithTheme) => css`\n outline: 1px solid ${props.theme.colors.brand[600]};\n outline-offset: -1px;\n `;\n}\n\nexport function textStyle(type: string, weight: keyof Theme['fontWeights'] = 'regular') {\n // eslint-disable-next-line complexity\n return (props: { theme: Theme }): string => {\n let cssVar = `font-weight: ${props.theme.fontWeights[weight]};`;\n // eslint-disable-next-line default-case\n switch (type) {\n case 'h1':\n cssVar += `\n font-size: ${toMobile('2.7692rem')};\n line-height: normal;\n `;\n break;\n case 'h2':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.title[800])};\n line-height: normal;\n `;\n break;\n case 'h3':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.title[700])};\n line-height: 1.2;\n `;\n break;\n case 'h4':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.title[600])};\n line-height: normal;\n `;\n break;\n case 'h5':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.title[500])};\n line-height: normal;\n `;\n break;\n case 'section-header':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.title[500])};\n line-height: normal;\n text-transform: uppercase;\n `;\n break;\n case 'body':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.value[400])};\n line-height: normal;\n `;\n break;\n case 'body-small':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.value[300])};\n line-height: normal;\n `;\n break;\n case 'body-micro':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.microText[200])};\n line-height: normal;\n `;\n break;\n case 'list':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.value[400])};\n line-height: normal;\n `;\n break;\n case 'link':\n cssVar += `\n line-height: ${props.theme.space.xl};\n color: ${props.theme.colors.brand[600]};\n cursor: pointer;\n `;\n break;\n }\n return cssVar;\n };\n}\n\nexport function iconColor(variant = 'neutral', type = 400) {\n return css`\n fill: ${th.color(`${variant}-${type}`)};\n `;\n}\n\nexport function fakeBorder() {\n return css`\n box-shadow: inset 0 0 0 1px ${(props) => props.theme.colors.neutral[200]};\n border-radius: 2px;\n `;\n}\n\nexport function fakeActive() {\n return css`\n outline: none;\n box-shadow: inset 0 0 0 1px ${(props) => props.theme.colors.brand[700]};\n border-radius: 2px;\n `;\n}\n\nexport function clearFocus(): string {\n return `\n border: none;\n box-shadow: none;\n `;\n}\n\nexport function buttonLink(): string {\n return `\n background-color: transparent;\n border: 1px solid transparent;\n cursor: pointer;\n `;\n}\n\nexport function transition(t = 'all 1s ease'): string {\n return `\n transition: ${t};\n `;\n}\n\nexport const onlySafariAndFirefox = (styles: string): FlattenSimpleInterpolation => css`\n @media not all and (min-resolution: 0.001dpcm) {\n ${styles}\n }\n @media screen and (min--moz-device-pixel-ratio: 0) {\n ${styles}\n }\n`;\n\nexport const onlySafari = (styles: string): string => `\n @media not all and (min-resolution: 0.001dpcm) {\n ${styles}\n }\n `;\n\nexport const onlyFirefox = (styles: string): string => `\n @media screen and (min--moz-device-pixel-ratio: 0) {\n ${styles}\n }\n `;\n\nexport const safariAndFirefoxBold = (color: string): string => `\n @media not all and (min-resolution: 0.001dpcm) {\n font-weight: 400;\n -webkit-font-smoothing: subpixel-antialiased;\n -webkit-text-stroke: 0.4px ${color};\n }\n @media screen and (min--moz-device-pixel-ratio: 0) {\n font-weight: 400;\n -webkit-font-smoothing: subpixel-antialiased;\n -webkit-text-stroke: 0.4px ${color};\n }\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uCAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADSvB,uBAAuB;AAEvB,+BAA4D;AAC5D,mBAAsB;AACtB,6BAAyB;AACzB,gBAAmB;AAMZ,SAAS,SAAS,OAAgB;AACvC,SAAO,CAAC,UAA8C;AAAA,MAClD,CAAC,CAAC,SAAS,MAAM,QAAQ,UAAW,MAAM,SAAS,KAAgB,MAAM,EAAE;AAAA;AAAA;AAAA;AAAA;AAKjF;AAEO,SAAS,aAAqB;AACnC,SAAO;AAAA;AAAA;AAAA;AAAA;AAKT;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-unsafe-return */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable no-shadow */\n/* eslint-disable max-lines */\n/* eslint-disable @typescript-eslint/no-shadow */\n\n// https://github.com/styled-components/babel-plugin-styled-components/issues/216#issuecomment-516941240\n\nimport type { Theme } from '@elliemae/pui-theme';\nimport { reduce } from 'lodash-es';\nimport type { Keyframes, FlattenSimpleInterpolation } from 'styled-components';\nimport { css, withTheme, keyframes as kfrm, useTheme } from '@xstyled/styled-components';\nimport { theme } from './theme.js';\nimport { toMobile } from './mobileUtilities.js';\nimport { th } from './th.js';\n\nexport { withTheme, useTheme, kfrm };\n\ntype PropsWithTheme<T = Record<string, unknown>> = T & { theme: Theme };\n\nexport function truncate(width?: string) {\n return (props: PropsWithTheme<{ width?: string }>) => css`\n ${!!width || props.width ? `width: ${(props.width || width) as string};` : ''}\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n `;\n}\n\nexport function flexCenter(): string {\n return `\n display: flex;\n justify-content: center;\n align-items: center;\n `;\n}\n\n/**\n * @deprecated Do not use it for a locked control. It returns `pointer-events: none` next to the `not-allowed` cursor,\n * and a `pointer-events: none` element is not hit-tested, so it never paints the cursor it declares and a user sees the\n * cursor of whatever is beneath it. The system-wide rule for `disabled`, `applyAriaDisabled` and `readOnly` keeps the\n * pointer events and stops the actions in JavaScript (see `lockedStateInteractionCss` in this package, which gives the\n * cursor only, and `omitLockedHandlers` in `@elliemae/ds-props-helpers`). It stays exported only because removing a\n * public export is a breaking change; it is removed under the breaking change protocol.\n */\nexport function disabled(): string {\n return `\n cursor: not-allowed;\n pointer-events: none;\n `;\n}\n\nexport function keyframes(obj: Record<string, string>): Keyframes {\n return kfrm`${reduce(\n obj,\n (result, value, key) => `\n ${result}\n ${key}% {\n ${value}\n }\n `,\n '',\n )}\n `;\n}\n\n// eslint-disable-next-line max-params\nexport function boxShadow(top: string, left: string, blur: string, color: string, inset = false): string {\n return `box-shadow: ${inset ? 'inset' : ''} ${top} ${left} ${blur} ${color};`;\n}\n\n// export function color(variant = 'neutral', type: string | number = 400) {\n// return css`\n// color: ${th.color(`${variant}-${type}`)};\n// `;\n// }\n\nexport function border(color = theme.colors.brand[600], size = '1px', type = 'solid'): string {\n return `${size} ${type} ${color}`;\n}\n\nexport function animation(animationKeyframes: string, animationLength: string, animationTimingFn: string) {\n return (props: { animationKeyframes?: string; animationLength?: string; animationTimingFn?: string }) => css`\n animation: ${props.animationKeyframes || animationKeyframes} ${props.animationLength || animationLength}\n ${props.animationTimingFn || animationTimingFn};\n `;\n}\n\nexport function active() {\n return (props: PropsWithTheme) => css`\n outline: none;\n border: 1px solid ${props.theme.colors.brand[700]};\n border-radius: 2px;\n `;\n}\n\nexport function hover() {\n return (props: PropsWithTheme) => css`\n outline: 1px solid ${props.theme.colors.brand[600]};\n outline-offset: -1px;\n `;\n}\n\nexport function textStyle(type: string, weight: keyof Theme['fontWeights'] = 'regular') {\n // eslint-disable-next-line complexity\n return (props: { theme: Theme }): string => {\n let cssVar = `font-weight: ${props.theme.fontWeights[weight]};`;\n // eslint-disable-next-line default-case\n switch (type) {\n case 'h1':\n cssVar += `\n font-size: ${toMobile('2.7692rem')};\n line-height: normal;\n `;\n break;\n case 'h2':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.title[800])};\n line-height: normal;\n `;\n break;\n case 'h3':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.title[700])};\n line-height: 1.2;\n `;\n break;\n case 'h4':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.title[600])};\n line-height: normal;\n `;\n break;\n case 'h5':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.title[500])};\n line-height: normal;\n `;\n break;\n case 'section-header':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.title[500])};\n line-height: normal;\n text-transform: uppercase;\n `;\n break;\n case 'body':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.value[400])};\n line-height: normal;\n `;\n break;\n case 'body-small':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.value[300])};\n line-height: normal;\n `;\n break;\n case 'body-micro':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.microText[200])};\n line-height: normal;\n `;\n break;\n case 'list':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.value[400])};\n line-height: normal;\n `;\n break;\n case 'link':\n cssVar += `\n line-height: ${props.theme.space.xl};\n color: ${props.theme.colors.brand[600]};\n cursor: pointer;\n `;\n break;\n }\n return cssVar;\n };\n}\n\nexport function iconColor(variant = 'neutral', type = 400) {\n return css`\n fill: ${th.color(`${variant}-${type}`)};\n `;\n}\n\nexport function fakeBorder() {\n return css`\n box-shadow: inset 0 0 0 1px ${(props) => props.theme.colors.neutral[200]};\n border-radius: 2px;\n `;\n}\n\nexport function fakeActive() {\n return css`\n outline: none;\n box-shadow: inset 0 0 0 1px ${(props) => props.theme.colors.brand[700]};\n border-radius: 2px;\n `;\n}\n\nexport function clearFocus(): string {\n return `\n border: none;\n box-shadow: none;\n `;\n}\n\nexport function buttonLink(): string {\n return `\n background-color: transparent;\n border: 1px solid transparent;\n cursor: pointer;\n `;\n}\n\nexport function transition(t = 'all 1s ease'): string {\n return `\n transition: ${t};\n `;\n}\n\nexport const onlySafariAndFirefox = (styles: string): FlattenSimpleInterpolation => css`\n @media not all and (min-resolution: 0.001dpcm) {\n ${styles}\n }\n @media screen and (min--moz-device-pixel-ratio: 0) {\n ${styles}\n }\n`;\n\nexport const onlySafari = (styles: string): string => `\n @media not all and (min-resolution: 0.001dpcm) {\n ${styles}\n }\n `;\n\nexport const onlyFirefox = (styles: string): string => `\n @media screen and (min--moz-device-pixel-ratio: 0) {\n ${styles}\n }\n `;\n\nexport const safariAndFirefoxBold = (color: string): string => `\n @media not all and (min-resolution: 0.001dpcm) {\n font-weight: 400;\n -webkit-font-smoothing: subpixel-antialiased;\n -webkit-text-stroke: 0.4px ${color};\n }\n @media screen and (min--moz-device-pixel-ratio: 0) {\n font-weight: 400;\n -webkit-font-smoothing: subpixel-antialiased;\n -webkit-text-stroke: 0.4px ${color};\n }\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": ["kfrm", "kfrm"]
|
|
7
7
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -63,6 +63,7 @@ import {
|
|
|
63
63
|
} from "./HtmlComponents.js";
|
|
64
64
|
export * from "./arithmetic.js";
|
|
65
65
|
export * from "./globalStyles.js";
|
|
66
|
+
export * from "./lockedStateCss.js";
|
|
66
67
|
export * from "./mergeRefs.js";
|
|
67
68
|
export * from "./mobileUtilities.js";
|
|
68
69
|
export * from "./spaceUtilities.js";
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { ThemeContext } from '@xstyled/styled-components';\nexport { position, typography } from '@xstyled/system';\nexport {\n A,\n Abbr,\n Address,\n Article,\n Aside,\n B,\n Bdi,\n Bdo,\n Blockquote,\n Br,\n Cite,\n Code,\n Data,\n Dd,\n Dfn,\n Div,\n Dl,\n Dt,\n Em,\n Figcaption,\n Figure,\n Footer,\n H1,\n H2,\n H3,\n H4,\n H5,\n H6,\n Header,\n Hgroup,\n Hr,\n I,\n Kbd,\n Li,\n Main,\n Mark,\n Menu,\n Nav,\n Ol,\n P,\n Pre,\n Q,\n Rp,\n Rt,\n Ruby,\n S,\n Samp,\n Search,\n Section,\n Small,\n Span,\n Strong,\n Sub,\n Sup,\n Time,\n U,\n Ul,\n Wbr,\n} from './HtmlComponents.js';\nexport * from './arithmetic.js';\nexport * from './globalStyles.js';\nexport * from './mergeRefs.js';\nexport * from './mobileUtilities.js';\nexport * from './spaceUtilities.js';\nexport * from './styled/index.js';\nexport * from './th.js';\nexport * from './theme.js';\nexport { themeProviderHOC } from './themeProviderHOC.js';\nexport * from './utils.js';\nexport { XStyledWrapper, xStyledCommonProps } from './xStyledWrapper.js';\n// styled components uses csstype types internally but doesn't solve the types export correctly\n// so to fix ts2742 we need to re-export the types from csstype...\nexport type * from 'csstype';\nexport { useGetLayoutMode } from './useGetLayoutMode.js';\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,oBAAoB;AAC7B,SAAS,UAAU,kBAAkB;AACrC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,SAAS,wBAAwB;AACjC,cAAc;AACd,SAAS,gBAAgB,0BAA0B;AAInD,SAAS,wBAAwB;",
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { ThemeContext } from '@xstyled/styled-components';\nexport { position, typography } from '@xstyled/system';\nexport {\n A,\n Abbr,\n Address,\n Article,\n Aside,\n B,\n Bdi,\n Bdo,\n Blockquote,\n Br,\n Cite,\n Code,\n Data,\n Dd,\n Dfn,\n Div,\n Dl,\n Dt,\n Em,\n Figcaption,\n Figure,\n Footer,\n H1,\n H2,\n H3,\n H4,\n H5,\n H6,\n Header,\n Hgroup,\n Hr,\n I,\n Kbd,\n Li,\n Main,\n Mark,\n Menu,\n Nav,\n Ol,\n P,\n Pre,\n Q,\n Rp,\n Rt,\n Ruby,\n S,\n Samp,\n Search,\n Section,\n Small,\n Span,\n Strong,\n Sub,\n Sup,\n Time,\n U,\n Ul,\n Wbr,\n} from './HtmlComponents.js';\nexport * from './arithmetic.js';\nexport * from './globalStyles.js';\nexport * from './lockedStateCss.js';\nexport * from './mergeRefs.js';\nexport * from './mobileUtilities.js';\nexport * from './spaceUtilities.js';\nexport * from './styled/index.js';\nexport * from './th.js';\nexport * from './theme.js';\nexport { themeProviderHOC } from './themeProviderHOC.js';\nexport * from './utils.js';\nexport { XStyledWrapper, xStyledCommonProps } from './xStyledWrapper.js';\n// styled components uses csstype types internally but doesn't solve the types export correctly\n// so to fix ts2742 we need to re-export the types from csstype...\nexport type * from 'csstype';\nexport { useGetLayoutMode } from './useGetLayoutMode.js';\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,oBAAoB;AAC7B,SAAS,UAAU,kBAAkB;AACrC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,SAAS,wBAAwB;AACjC,cAAc;AACd,SAAS,gBAAgB,0BAA0B;AAInD,SAAS,wBAAwB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { css } from "@xstyled/styled-components";
|
|
3
|
+
const disabledInteractionCss = css`
|
|
4
|
+
cursor: not-allowed;
|
|
5
|
+
`;
|
|
6
|
+
const ariaDisabledInteractionCss = css`
|
|
7
|
+
cursor: not-allowed;
|
|
8
|
+
`;
|
|
9
|
+
const lockedStateInteractionCss = css`
|
|
10
|
+
${({ $disabled }) => $disabled && css`
|
|
11
|
+
&& {
|
|
12
|
+
${disabledInteractionCss}
|
|
13
|
+
}
|
|
14
|
+
`}
|
|
15
|
+
${({ $disabled, $applyAriaDisabled, $readOnly }) => !$disabled && ($applyAriaDisabled || $readOnly) && css`
|
|
16
|
+
&& {
|
|
17
|
+
${ariaDisabledInteractionCss}
|
|
18
|
+
}
|
|
19
|
+
`}
|
|
20
|
+
&&:disabled {
|
|
21
|
+
${disabledInteractionCss}
|
|
22
|
+
}
|
|
23
|
+
&&[aria-disabled='true'] {
|
|
24
|
+
${ariaDisabledInteractionCss}
|
|
25
|
+
}
|
|
26
|
+
`;
|
|
27
|
+
export {
|
|
28
|
+
ariaDisabledInteractionCss,
|
|
29
|
+
disabledInteractionCss,
|
|
30
|
+
lockedStateInteractionCss
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=lockedStateCss.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/lockedStateCss.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { css } from '@xstyled/styled-components';\n\n// Shared interaction styles of the three lock states (PUI-16695). Colours, borders and backgrounds stay per component:\n// only what the three states have in common lives here.\n// - disabled (hard lock): the only CSS is a not-allowed cursor. Pointer events are not touched, so the element stays\n// hit-testable and paints its own cursor.\n// - applyAriaDisabled / readOnly (soft locks, synonyms): the same not-allowed cursor. Focus and hover stay live.\n// Stopping the actions is not CSS's job, in either state. It is JavaScript: the shared helpers `omitLockedHandlers` and\n// `isLocked` from `@elliemae/ds-props-helpers`, and each component's own gates. A locked element can still receive a\n// click or a key, and the handler gate is what keeps the consumer callback from running.\n// Hover and active styles of a hard-locked element are not handled here. Each component guards its own `:hover` and\n// `:active` rules against the lock (`:not(:disabled)`, `!$disabled &&`, ...).\n//\n// Two ways to reach the same result, both handled by `lockedStateInteractionCss`:\n// 1. transient props (`$disabled`, `$applyAriaDisabled`, `$readOnly`): for elements that cannot express the state in\n// the DOM by themselves. styled-components never forwards `$` props, so a non-native element never prints a\n// meaningless `disabled=\"\"`. `$disabled` is the only way to say \"hard lock\" on a non-native element, because there a\n// disabled falls back to `aria-disabled=\"true\"`, which is indistinguishable from applyAriaDisabled in the DOM.\n// 2. DOM selectors (`:disabled`, `[aria-disabled='true']`): for native controls and for anything that already prints\n// the state. The styles then read the same DOM the screen reader sees, so they cannot drift from it.\n// Specificity: the DOM-selector rules (`&&:disabled`, `&&[aria-disabled='true']`) are (0,3,0) and beat a component's own\n// `&:hover { cursor: ... }` whatever the source order is. The transient-prop rules use `&&` (0,2,0): they tie with a\n// component's own `&:hover`, so place `lockedStateInteractionCss` AFTER the component's hover rules and the lock wins.\n\nexport type LockedStateStyleProps = {\n $disabled?: boolean;\n $applyAriaDisabled?: boolean;\n $readOnly?: boolean;\n};\n\n/**\n * `disabled` (hard lock) interaction: a not-allowed cursor and nothing else. The element keeps its pointer events, so\n * it paints the cursor itself. The actions are stopped in JavaScript.\n */\nexport const disabledInteractionCss = css`\n cursor: not-allowed;\n`;\n\n/**\n * `applyAriaDisabled` / `readOnly` (soft lock) interaction: a not-allowed cursor. Hover and focus stay live, and the\n * component ignores the actions in JavaScript.\n */\nexport const ariaDisabledInteractionCss = css`\n cursor: not-allowed;\n`;\n\n/**\n * Drop-in for a styled template: `${lockedStateInteractionCss}`.\n * Reads `$disabled`, `$applyAriaDisabled`, `$readOnly` and the DOM (`:disabled`, `[aria-disabled='true']`).\n * Put it in the same template as the component's own states; its selectors win by specificity, not by order.\n */\nexport const lockedStateInteractionCss = css<LockedStateStyleProps>`\n ${({ $disabled }) =>\n $disabled &&\n css`\n && {\n ${disabledInteractionCss}\n }\n `}\n ${({ $disabled, $applyAriaDisabled, $readOnly }) =>\n !$disabled &&\n ($applyAriaDisabled || $readOnly) &&\n css`\n && {\n ${ariaDisabledInteractionCss}\n }\n `}\n &&:disabled {\n ${disabledInteractionCss}\n }\n &&[aria-disabled='true'] {\n ${ariaDisabledInteractionCss}\n }\n`;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,WAAW;AAkCb,MAAM,yBAAyB;AAAA;AAAA;AAQ/B,MAAM,6BAA6B;AAAA;AAAA;AASnC,MAAM,4BAA4B;AAAA,IACrC,CAAC,EAAE,UAAU,MACb,aACA;AAAA;AAAA,UAEM,sBAAsB;AAAA;AAAA,KAE3B;AAAA,IACD,CAAC,EAAE,WAAW,oBAAoB,UAAU,MAC5C,CAAC,cACA,sBAAsB,cACvB;AAAA;AAAA,UAEM,0BAA0B;AAAA;AAAA,KAE/B;AAAA;AAAA,MAEC,sBAAsB;AAAA;AAAA;AAAA,MAGtB,0BAA0B;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
This document delves into the internal mechanics of our custom styled-component wrapper, providing insights for developers who need to understand or extend its functionality.
|
|
4
4
|
|
|
5
5
|
#### Overview
|
|
6
|
+
|
|
6
7
|
The wrapper is designed to extend the standard functionality of styled-components with additional features like automatic theme coercion, design system integration, and automatic attribute generation. It acts as a higher-order component (HOC) that wraps around the base styled component.
|
|
7
8
|
|
|
8
9
|
#### Understanding Tagged Template Literals
|
|
10
|
+
|
|
9
11
|
In standard styled-components usage, styled components are often defined using tagged template literals, a feature of ES6. For example:
|
|
10
12
|
|
|
11
13
|
```typescript
|
|
@@ -19,7 +21,7 @@ This syntax is concise and readable, especially for defining component styles th
|
|
|
19
21
|
But, for the purpose of this document, you should understand the real way this gets "transpiled" to:
|
|
20
22
|
|
|
21
23
|
```typescript
|
|
22
|
-
styled('button')(['margin: ', ';\n'], ({theme}) => theme.space.xs);
|
|
24
|
+
styled('button')(['margin: ', ';\n'], ({ theme }) => theme.space.xs);
|
|
23
25
|
```
|
|
24
26
|
|
|
25
27
|
So, `styled` is a function that takes a tag (in this case, `'button'`) and returns a function that takes any number of arguments. The first argument is an array of strings (the constant parts of the template literal), and the rest are the interpolated values (the dynamic parts of the template literal). Each interpolated value will be inserted into the array of strings at the corresponding index.
|
|
@@ -74,10 +76,10 @@ return Object.assign(dsStyledResolver, styledAttributes);
|
|
|
74
76
|
It looks scary. But let's break it down.
|
|
75
77
|
|
|
76
78
|
1. We create a base styled resolver using the `baseStyled` function. This is just calling the ORIGINAL `styled` function from `styled-components` (we just changed its name when importing it).
|
|
77
|
-
Ultimately, this is the function that will be called when we use our styled component, since we are just building a wrapper of it.
|
|
79
|
+
Ultimately, this is the function that will be called when we use our styled component, since we are just building a wrapper of it.
|
|
78
80
|
|
|
79
81
|
2. We create a new resolver, `dsStyledResolver`, that will be the one that will be returned by our wrapper. It has to receive as a first argument the styleArg, which is the style object or string that we pass to the styled component. The rest of the arguments are the interpolated values of the tagged template literal.
|
|
80
|
-
This function will do a lot of magic, but it will ultimately call the `baseStyledResolver` with the correct arguments.
|
|
82
|
+
This function will do a lot of magic, but it will ultimately call the `baseStyledResolver` with the correct arguments.
|
|
81
83
|
|
|
82
84
|
3. We create an object with two methods, `attrs` and `withConfig`, that will be used to augment the styled component. These methods are just calling the original methods of the `baseStyledResolver`, and then returning the `dsStyledResolver` itself. This is just to make sure that the styled component is augmented with the correct methods.
|
|
83
85
|
|
|
@@ -95,9 +97,9 @@ Well, this function is needed for something we do later in the code, but the bas
|
|
|
95
97
|
|
|
96
98
|
```typescript
|
|
97
99
|
const StyledChat = styled('div')`
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
${StyledChatBubble} {
|
|
101
|
+
margin: 0;
|
|
102
|
+
}
|
|
101
103
|
`;
|
|
102
104
|
```
|
|
103
105
|
|
|
@@ -110,20 +112,20 @@ The `dsStyledComponentTransform` function will transform the styled component in
|
|
|
110
112
|
So basically it will transform `StyledChatBubble`
|
|
111
113
|
|
|
112
114
|
```typescript
|
|
113
|
-
`.${StyledChatBubble.dsStyledComponentId}
|
|
115
|
+
`.${StyledChatBubble.dsStyledComponentId}`;
|
|
114
116
|
```
|
|
115
117
|
|
|
116
118
|
Notice the `.` before the interpolation. This is because we are interpolating a class name, and we need to add the `.` to make it a valid CSS selector.
|
|
117
119
|
|
|
118
120
|
```typescript
|
|
119
|
-
|
|
121
|
+
const [styleArgWithMagic, expressionsWithMagic] = magicCssTransform(styleArg, expressionsWithDsStyledComponentId);
|
|
120
122
|
```
|
|
121
123
|
|
|
122
124
|
This transformation allows our styled components to be MAGICAL. Meaning, we support things like this:
|
|
123
125
|
|
|
124
126
|
```typescript
|
|
125
127
|
const StyledButton = styled('button')`
|
|
126
|
-
|
|
128
|
+
color: neutral-100;
|
|
127
129
|
`;
|
|
128
130
|
```
|
|
129
131
|
|
|
@@ -135,7 +137,7 @@ Then we need to replace that token with the corresponding value from the theme,
|
|
|
135
137
|
|
|
136
138
|
```typescript
|
|
137
139
|
const StyledButton = styled('button')`
|
|
138
|
-
|
|
140
|
+
color: ${({ theme }) => theme.colors.neutral[100]};
|
|
139
141
|
`;
|
|
140
142
|
```
|
|
141
143
|
|
|
@@ -163,16 +165,15 @@ expresions = [f1, f2, f3]
|
|
|
163
165
|
expressions = [({theme,...rest}) => f1({...rest, theme: theme ?? defaultTheme}), ...]
|
|
164
166
|
```
|
|
165
167
|
|
|
166
|
-
|
|
167
168
|
Let's look at the next important part
|
|
168
169
|
|
|
169
170
|
```typescript
|
|
170
171
|
if (componentName && componentSlot) {
|
|
171
|
-
|
|
172
|
+
expressionsWithThemeCoerced.push(genStyleOverridesExpression(componentName, componentSlot));
|
|
172
173
|
}
|
|
173
174
|
|
|
174
175
|
if (componentName && componentSlot === 'root') {
|
|
175
|
-
|
|
176
|
+
expressionsWithThemeCoerced.push(genVariantOverridesExpression(componentName));
|
|
176
177
|
}
|
|
177
178
|
|
|
178
179
|
const numOfExpressionsAdded = expressionsWithThemeCoerced.length - expressionsWithMagic.length;
|
|
@@ -186,15 +187,14 @@ Notice that we are adding the expressions at the end of the array, so they will
|
|
|
186
187
|
|
|
187
188
|
It's also important to note that we need to fix the styleArg after adding the expressions, since we added new expressions, and we need to adjust the styleArg to match the new expressions array.
|
|
188
189
|
|
|
189
|
-
|
|
190
190
|
In the next part, we just generate some autocalculated values, like display name, data-testids, classNames, etc. And then, we just add them one by one by using the `attrs` function
|
|
191
191
|
|
|
192
192
|
```typescript
|
|
193
193
|
const [displayName, attributes] = generateAutoCalculated(options);
|
|
194
194
|
|
|
195
195
|
const baseStyledResolverWithAttributes = attributes.reduce<typeof baseStyledResolver>(
|
|
196
|
-
|
|
197
|
-
|
|
196
|
+
(curStyledResolver, attributeFunc) => curStyledResolver.attrs(attributeFunc),
|
|
197
|
+
baseStyledResolver,
|
|
198
198
|
);
|
|
199
199
|
```
|
|
200
200
|
|
|
@@ -209,7 +209,6 @@ So, wrapper ONLY augments the styleArg and expressions, and then calls the origi
|
|
|
209
209
|
|
|
210
210
|
There is an extra piece of logic after this, which is creating a wrapper for this component that automatically merges refs, puts global attributes, etc.
|
|
211
211
|
|
|
212
|
-
|
|
213
212
|
```typescript
|
|
214
213
|
const ComponentWithRefsMerged = (props: OwnerInterface & InnerRefInterface<C> & { 'data-testid'?: string }) => {
|
|
215
214
|
// we may or not have data-testid at this point, so we need to calculate it
|
|
@@ -249,4 +248,4 @@ We need to add the `dsStyledComponentId` and `toString` to the wrapper, so we ca
|
|
|
249
248
|
```typescript
|
|
250
249
|
ComponentWithRefsMerged.dsStyledComponentId = Component.styledComponentId as string;
|
|
251
250
|
ComponentWithRefsMerged.toString = Component.toString;
|
|
252
|
-
```
|
|
251
|
+
```
|
package/dist/esm/utils.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/utils.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unsafe-return */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable no-shadow */\n/* eslint-disable max-lines */\n/* eslint-disable @typescript-eslint/no-shadow */\n\n// https://github.com/styled-components/babel-plugin-styled-components/issues/216#issuecomment-516941240\n\nimport type { Theme } from '@elliemae/pui-theme';\nimport { reduce } from 'lodash-es';\nimport type { Keyframes, FlattenSimpleInterpolation } from 'styled-components';\nimport { css, withTheme, keyframes as kfrm, useTheme } from '@xstyled/styled-components';\nimport { theme } from './theme.js';\nimport { toMobile } from './mobileUtilities.js';\nimport { th } from './th.js';\n\nexport { withTheme, useTheme, kfrm };\n\ntype PropsWithTheme<T = Record<string, unknown>> = T & { theme: Theme };\n\nexport function truncate(width?: string) {\n return (props: PropsWithTheme<{ width?: string }>) => css`\n ${!!width || props.width ? `width: ${(props.width || width) as string};` : ''}\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n `;\n}\n\nexport function flexCenter(): string {\n return `\n display: flex;\n justify-content: center;\n align-items: center;\n `;\n}\n\nexport function disabled(): string {\n return `\n cursor: not-allowed;\n pointer-events: none;\n `;\n}\n\nexport function keyframes(obj: Record<string, string>): Keyframes {\n return kfrm`${reduce(\n obj,\n (result, value, key) => `\n ${result}\n ${key}% {\n ${value}\n }\n `,\n '',\n )}\n `;\n}\n\n// eslint-disable-next-line max-params\nexport function boxShadow(top: string, left: string, blur: string, color: string, inset = false): string {\n return `box-shadow: ${inset ? 'inset' : ''} ${top} ${left} ${blur} ${color};`;\n}\n\n// export function color(variant = 'neutral', type: string | number = 400) {\n// return css`\n// color: ${th.color(`${variant}-${type}`)};\n// `;\n// }\n\nexport function border(color = theme.colors.brand[600], size = '1px', type = 'solid'): string {\n return `${size} ${type} ${color}`;\n}\n\nexport function animation(animationKeyframes: string, animationLength: string, animationTimingFn: string) {\n return (props: { animationKeyframes?: string; animationLength?: string; animationTimingFn?: string }) => css`\n animation: ${props.animationKeyframes || animationKeyframes} ${props.animationLength || animationLength}\n ${props.animationTimingFn || animationTimingFn};\n `;\n}\n\nexport function active() {\n return (props: PropsWithTheme) => css`\n outline: none;\n border: 1px solid ${props.theme.colors.brand[700]};\n border-radius: 2px;\n `;\n}\n\nexport function hover() {\n return (props: PropsWithTheme) => css`\n outline: 1px solid ${props.theme.colors.brand[600]};\n outline-offset: -1px;\n `;\n}\n\nexport function textStyle(type: string, weight: keyof Theme['fontWeights'] = 'regular') {\n // eslint-disable-next-line complexity\n return (props: { theme: Theme }): string => {\n let cssVar = `font-weight: ${props.theme.fontWeights[weight]};`;\n // eslint-disable-next-line default-case\n switch (type) {\n case 'h1':\n cssVar += `\n font-size: ${toMobile('2.7692rem')};\n line-height: normal;\n `;\n break;\n case 'h2':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.title[800])};\n line-height: normal;\n `;\n break;\n case 'h3':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.title[700])};\n line-height: 1.2;\n `;\n break;\n case 'h4':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.title[600])};\n line-height: normal;\n `;\n break;\n case 'h5':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.title[500])};\n line-height: normal;\n `;\n break;\n case 'section-header':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.title[500])};\n line-height: normal;\n text-transform: uppercase;\n `;\n break;\n case 'body':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.value[400])};\n line-height: normal;\n `;\n break;\n case 'body-small':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.value[300])};\n line-height: normal;\n `;\n break;\n case 'body-micro':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.microText[200])};\n line-height: normal;\n `;\n break;\n case 'list':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.value[400])};\n line-height: normal;\n `;\n break;\n case 'link':\n cssVar += `\n line-height: ${props.theme.space.xl};\n color: ${props.theme.colors.brand[600]};\n cursor: pointer;\n `;\n break;\n }\n return cssVar;\n };\n}\n\nexport function iconColor(variant = 'neutral', type = 400) {\n return css`\n fill: ${th.color(`${variant}-${type}`)};\n `;\n}\n\nexport function fakeBorder() {\n return css`\n box-shadow: inset 0 0 0 1px ${(props) => props.theme.colors.neutral[200]};\n border-radius: 2px;\n `;\n}\n\nexport function fakeActive() {\n return css`\n outline: none;\n box-shadow: inset 0 0 0 1px ${(props) => props.theme.colors.brand[700]};\n border-radius: 2px;\n `;\n}\n\nexport function clearFocus(): string {\n return `\n border: none;\n box-shadow: none;\n `;\n}\n\nexport function buttonLink(): string {\n return `\n background-color: transparent;\n border: 1px solid transparent;\n cursor: pointer;\n `;\n}\n\nexport function transition(t = 'all 1s ease'): string {\n return `\n transition: ${t};\n `;\n}\n\nexport const onlySafariAndFirefox = (styles: string): FlattenSimpleInterpolation => css`\n @media not all and (min-resolution: 0.001dpcm) {\n ${styles}\n }\n @media screen and (min--moz-device-pixel-ratio: 0) {\n ${styles}\n }\n`;\n\nexport const onlySafari = (styles: string): string => `\n @media not all and (min-resolution: 0.001dpcm) {\n ${styles}\n }\n `;\n\nexport const onlyFirefox = (styles: string): string => `\n @media screen and (min--moz-device-pixel-ratio: 0) {\n ${styles}\n }\n `;\n\nexport const safariAndFirefoxBold = (color: string): string => `\n @media not all and (min-resolution: 0.001dpcm) {\n font-weight: 400;\n -webkit-font-smoothing: subpixel-antialiased;\n -webkit-text-stroke: 0.4px ${color};\n }\n @media screen and (min--moz-device-pixel-ratio: 0) {\n font-weight: 400;\n -webkit-font-smoothing: subpixel-antialiased;\n -webkit-text-stroke: 0.4px ${color};\n }\n`;\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACSvB,SAAS,cAAc;AAEvB,SAAS,KAAK,WAAW,aAAa,MAAM,gBAAgB;AAC5D,SAAS,aAAa;AACtB,SAAS,gBAAgB;AACzB,SAAS,UAAU;AAMZ,SAAS,SAAS,OAAgB;AACvC,SAAO,CAAC,UAA8C;AAAA,MAClD,CAAC,CAAC,SAAS,MAAM,QAAQ,UAAW,MAAM,SAAS,KAAgB,MAAM,EAAE;AAAA;AAAA;AAAA;AAAA;AAKjF;AAEO,SAAS,aAAqB;AACnC,SAAO;AAAA;AAAA;AAAA;AAAA;AAKT;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unsafe-return */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable no-shadow */\n/* eslint-disable max-lines */\n/* eslint-disable @typescript-eslint/no-shadow */\n\n// https://github.com/styled-components/babel-plugin-styled-components/issues/216#issuecomment-516941240\n\nimport type { Theme } from '@elliemae/pui-theme';\nimport { reduce } from 'lodash-es';\nimport type { Keyframes, FlattenSimpleInterpolation } from 'styled-components';\nimport { css, withTheme, keyframes as kfrm, useTheme } from '@xstyled/styled-components';\nimport { theme } from './theme.js';\nimport { toMobile } from './mobileUtilities.js';\nimport { th } from './th.js';\n\nexport { withTheme, useTheme, kfrm };\n\ntype PropsWithTheme<T = Record<string, unknown>> = T & { theme: Theme };\n\nexport function truncate(width?: string) {\n return (props: PropsWithTheme<{ width?: string }>) => css`\n ${!!width || props.width ? `width: ${(props.width || width) as string};` : ''}\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n `;\n}\n\nexport function flexCenter(): string {\n return `\n display: flex;\n justify-content: center;\n align-items: center;\n `;\n}\n\n/**\n * @deprecated Do not use it for a locked control. It returns `pointer-events: none` next to the `not-allowed` cursor,\n * and a `pointer-events: none` element is not hit-tested, so it never paints the cursor it declares and a user sees the\n * cursor of whatever is beneath it. The system-wide rule for `disabled`, `applyAriaDisabled` and `readOnly` keeps the\n * pointer events and stops the actions in JavaScript (see `lockedStateInteractionCss` in this package, which gives the\n * cursor only, and `omitLockedHandlers` in `@elliemae/ds-props-helpers`). It stays exported only because removing a\n * public export is a breaking change; it is removed under the breaking change protocol.\n */\nexport function disabled(): string {\n return `\n cursor: not-allowed;\n pointer-events: none;\n `;\n}\n\nexport function keyframes(obj: Record<string, string>): Keyframes {\n return kfrm`${reduce(\n obj,\n (result, value, key) => `\n ${result}\n ${key}% {\n ${value}\n }\n `,\n '',\n )}\n `;\n}\n\n// eslint-disable-next-line max-params\nexport function boxShadow(top: string, left: string, blur: string, color: string, inset = false): string {\n return `box-shadow: ${inset ? 'inset' : ''} ${top} ${left} ${blur} ${color};`;\n}\n\n// export function color(variant = 'neutral', type: string | number = 400) {\n// return css`\n// color: ${th.color(`${variant}-${type}`)};\n// `;\n// }\n\nexport function border(color = theme.colors.brand[600], size = '1px', type = 'solid'): string {\n return `${size} ${type} ${color}`;\n}\n\nexport function animation(animationKeyframes: string, animationLength: string, animationTimingFn: string) {\n return (props: { animationKeyframes?: string; animationLength?: string; animationTimingFn?: string }) => css`\n animation: ${props.animationKeyframes || animationKeyframes} ${props.animationLength || animationLength}\n ${props.animationTimingFn || animationTimingFn};\n `;\n}\n\nexport function active() {\n return (props: PropsWithTheme) => css`\n outline: none;\n border: 1px solid ${props.theme.colors.brand[700]};\n border-radius: 2px;\n `;\n}\n\nexport function hover() {\n return (props: PropsWithTheme) => css`\n outline: 1px solid ${props.theme.colors.brand[600]};\n outline-offset: -1px;\n `;\n}\n\nexport function textStyle(type: string, weight: keyof Theme['fontWeights'] = 'regular') {\n // eslint-disable-next-line complexity\n return (props: { theme: Theme }): string => {\n let cssVar = `font-weight: ${props.theme.fontWeights[weight]};`;\n // eslint-disable-next-line default-case\n switch (type) {\n case 'h1':\n cssVar += `\n font-size: ${toMobile('2.7692rem')};\n line-height: normal;\n `;\n break;\n case 'h2':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.title[800])};\n line-height: normal;\n `;\n break;\n case 'h3':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.title[700])};\n line-height: 1.2;\n `;\n break;\n case 'h4':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.title[600])};\n line-height: normal;\n `;\n break;\n case 'h5':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.title[500])};\n line-height: normal;\n `;\n break;\n case 'section-header':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.title[500])};\n line-height: normal;\n text-transform: uppercase;\n `;\n break;\n case 'body':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.value[400])};\n line-height: normal;\n `;\n break;\n case 'body-small':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.value[300])};\n line-height: normal;\n `;\n break;\n case 'body-micro':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.microText[200])};\n line-height: normal;\n `;\n break;\n case 'list':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.value[400])};\n line-height: normal;\n `;\n break;\n case 'link':\n cssVar += `\n line-height: ${props.theme.space.xl};\n color: ${props.theme.colors.brand[600]};\n cursor: pointer;\n `;\n break;\n }\n return cssVar;\n };\n}\n\nexport function iconColor(variant = 'neutral', type = 400) {\n return css`\n fill: ${th.color(`${variant}-${type}`)};\n `;\n}\n\nexport function fakeBorder() {\n return css`\n box-shadow: inset 0 0 0 1px ${(props) => props.theme.colors.neutral[200]};\n border-radius: 2px;\n `;\n}\n\nexport function fakeActive() {\n return css`\n outline: none;\n box-shadow: inset 0 0 0 1px ${(props) => props.theme.colors.brand[700]};\n border-radius: 2px;\n `;\n}\n\nexport function clearFocus(): string {\n return `\n border: none;\n box-shadow: none;\n `;\n}\n\nexport function buttonLink(): string {\n return `\n background-color: transparent;\n border: 1px solid transparent;\n cursor: pointer;\n `;\n}\n\nexport function transition(t = 'all 1s ease'): string {\n return `\n transition: ${t};\n `;\n}\n\nexport const onlySafariAndFirefox = (styles: string): FlattenSimpleInterpolation => css`\n @media not all and (min-resolution: 0.001dpcm) {\n ${styles}\n }\n @media screen and (min--moz-device-pixel-ratio: 0) {\n ${styles}\n }\n`;\n\nexport const onlySafari = (styles: string): string => `\n @media not all and (min-resolution: 0.001dpcm) {\n ${styles}\n }\n `;\n\nexport const onlyFirefox = (styles: string): string => `\n @media screen and (min--moz-device-pixel-ratio: 0) {\n ${styles}\n }\n `;\n\nexport const safariAndFirefoxBold = (color: string): string => `\n @media not all and (min-resolution: 0.001dpcm) {\n font-weight: 400;\n -webkit-font-smoothing: subpixel-antialiased;\n -webkit-text-stroke: 0.4px ${color};\n }\n @media screen and (min--moz-device-pixel-ratio: 0) {\n font-weight: 400;\n -webkit-font-smoothing: subpixel-antialiased;\n -webkit-text-stroke: 0.4px ${color};\n }\n`;\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { position, typography } from '@xstyled/system';
|
|
|
3
3
|
export { A, Abbr, Address, Article, Aside, B, Bdi, Bdo, Blockquote, Br, Cite, Code, Data, Dd, Dfn, Div, Dl, Dt, Em, Figcaption, Figure, Footer, H1, H2, H3, H4, H5, H6, Header, Hgroup, Hr, I, Kbd, Li, Main, Mark, Menu, Nav, Ol, P, Pre, Q, Rp, Rt, Ruby, S, Samp, Search, Section, Small, Span, Strong, Sub, Sup, Time, U, Ul, Wbr, } from './HtmlComponents.js';
|
|
4
4
|
export * from './arithmetic.js';
|
|
5
5
|
export * from './globalStyles.js';
|
|
6
|
+
export * from './lockedStateCss.js';
|
|
6
7
|
export * from './mergeRefs.js';
|
|
7
8
|
export * from './mobileUtilities.js';
|
|
8
9
|
export * from './spaceUtilities.js';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type LockedStateStyleProps = {
|
|
2
|
+
$disabled?: boolean;
|
|
3
|
+
$applyAriaDisabled?: boolean;
|
|
4
|
+
$readOnly?: boolean;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* `disabled` (hard lock) interaction: a not-allowed cursor and nothing else. The element keeps its pointer events, so
|
|
8
|
+
* it paints the cursor itself. The actions are stopped in JavaScript.
|
|
9
|
+
*/
|
|
10
|
+
export declare const disabledInteractionCss: import("styled-components").FlattenSimpleInterpolation;
|
|
11
|
+
/**
|
|
12
|
+
* `applyAriaDisabled` / `readOnly` (soft lock) interaction: a not-allowed cursor. Hover and focus stay live, and the
|
|
13
|
+
* component ignores the actions in JavaScript.
|
|
14
|
+
*/
|
|
15
|
+
export declare const ariaDisabledInteractionCss: import("styled-components").FlattenSimpleInterpolation;
|
|
16
|
+
/**
|
|
17
|
+
* Drop-in for a styled template: `${lockedStateInteractionCss}`.
|
|
18
|
+
* Reads `$disabled`, `$applyAriaDisabled`, `$readOnly` and the DOM (`:disabled`, `[aria-disabled='true']`).
|
|
19
|
+
* Put it in the same template as the component's own states; its selectors win by specificity, not by order.
|
|
20
|
+
*/
|
|
21
|
+
export declare const lockedStateInteractionCss: import("styled-components").FlattenInterpolation<import("styled-components").ThemedStyledProps<LockedStateStyleProps, import("@xstyled/system").Theme>>;
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -9,6 +9,14 @@ export declare function truncate(width?: string): (props: PropsWithTheme<{
|
|
|
9
9
|
width?: string;
|
|
10
10
|
}>) => FlattenSimpleInterpolation;
|
|
11
11
|
export declare function flexCenter(): string;
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated Do not use it for a locked control. It returns `pointer-events: none` next to the `not-allowed` cursor,
|
|
14
|
+
* and a `pointer-events: none` element is not hit-tested, so it never paints the cursor it declares and a user sees the
|
|
15
|
+
* cursor of whatever is beneath it. The system-wide rule for `disabled`, `applyAriaDisabled` and `readOnly` keeps the
|
|
16
|
+
* pointer events and stops the actions in JavaScript (see `lockedStateInteractionCss` in this package, which gives the
|
|
17
|
+
* cursor only, and `omitLockedHandlers` in `@elliemae/ds-props-helpers`). It stays exported only because removing a
|
|
18
|
+
* public export is a breaking change; it is removed under the breaking change protocol.
|
|
19
|
+
*/
|
|
12
20
|
export declare function disabled(): string;
|
|
13
21
|
export declare function keyframes(obj: Record<string, string>): Keyframes;
|
|
14
22
|
export declare function boxShadow(top: string, left: string, blur: string, color: string, inset?: boolean): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type ThemedExpression } from './styled/types.js';
|
|
2
|
-
export declare const XStyledWrapper: import("styled-components").StyledComponent<"div", import("./
|
|
2
|
+
export declare const XStyledWrapper: import("styled-components").StyledComponent<"div", import("./index.js").Theme, import("@xstyled/util").Props<import("@xstyled/system").Theme> & import("@xstyled/system").TypographyProps<import("@xstyled/system").Theme> & import("./index.js").OwnerInterface & import("./index.js").InnerRefInterface<"div">, never>;
|
|
3
3
|
export declare const xStyledCommonProps: ThemedExpression<unknown>;
|
|
4
4
|
export default XStyledWrapper;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-system",
|
|
3
|
-
"version": "3.80.0-next.
|
|
3
|
+
"version": "3.80.0-next.80",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - System",
|
|
6
6
|
"files": [
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
"@xstyled/util": "~3.7.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
+
"@elliemae/ds-monorepo-devops": "3.80.0-next.80",
|
|
49
|
+
"@elliemae/ds-typescript-helpers": "3.80.0-next.80",
|
|
48
50
|
"@elliemae/pui-theme": "~2.13.0",
|
|
49
51
|
"jest": "^30.0.0",
|
|
50
|
-
"styled-components": "~5.3.11"
|
|
51
|
-
"@elliemae/ds-monorepo-devops": "3.80.0-next.8",
|
|
52
|
-
"@elliemae/ds-typescript-helpers": "3.80.0-next.8"
|
|
52
|
+
"styled-components": "~5.3.11"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@elliemae/pui-theme": "~2.13.0",
|