@descope/web-components-ui 1.0.427 → 1.0.429
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/README.md +0 -1
- package/dist/cjs/index.cjs.js +2520 -5270
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +2022 -4815
- package/dist/index.esm.js.map +1 -1
- package/package.json +8 -16
- package/src/components/descope-apps-list/AppsListClass.js +1 -1
- package/src/components/descope-apps-list/index.js +2 -2
- package/src/components/descope-date-field/descope-calendar/index.js +1 -1
- package/src/components/descope-divider/DividerClass.js +1 -1
- package/src/components/descope-divider/index.js +1 -1
- package/src/components/descope-link/LinkClass.js +1 -1
- package/src/components/descope-link/index.js +1 -1
- package/src/components/descope-security-questions-setup/SecurityQuestionsSetupClass.js +1 -1
- package/src/components/descope-security-questions-setup/index.js +1 -1
- package/src/components/descope-security-questions-verify/SecurityQuestionsVerifyClass.js +1 -1
- package/src/components/descope-security-questions-verify/index.js +1 -1
- package/src/components/descope-user-attribute/UserAttributeClass.js +1 -1
- package/src/components/descope-user-attribute/index.js +1 -1
- package/src/components/descope-user-auth-method/UserAuthMethodClass.js +1 -1
- package/src/components/descope-user-auth-method/index.js +1 -1
- package/src/components/mapping-fields/descope-mappings-field/MappingsFieldClass.js +1 -1
- package/src/components/mapping-fields/descope-mappings-field/index.js +2 -2
- package/src/components/phone-fields/descope-phone-field/PhoneFieldClass.js +1 -1
- package/src/components/phone-fields/descope-phone-field/descope-phone-field-internal/index.js +1 -1
- package/src/components/phone-fields/descope-phone-field/index.js +1 -1
- package/src/components/phone-fields/descope-phone-input-box-field/index.js +1 -1
- package/src/helpers/themeHelpers/index.js +1 -1
- package/src/theme/components/alert.js +1 -1
- package/src/theme/components/enrichedText.js +1 -1
- package/src/theme/components/index.js +3 -3
- package/dist/index.d.ts +0 -72
- package/node_modules/common/.eslintrc.json +0 -18
- package/node_modules/common/README.md +0 -7
- package/node_modules/common/package.json +0 -37
- package/node_modules/common/project.json +0 -7
- package/node_modules/common/src/baseClasses/baseClasses/createBaseClass.js +0 -66
- package/node_modules/common/src/baseClasses/baseClasses/createBaseInputClass.js +0 -14
- package/node_modules/common/src/baseClasses/baseClasses/createCssVarImageClass.js +0 -55
- package/node_modules/common/src/baseClasses/index.js +0 -3
- package/node_modules/common/src/componentsHelpers/index.js +0 -95
- package/node_modules/common/src/componentsMixins/helpers/mixinsHelpers.js +0 -10
- package/node_modules/common/src/componentsMixins/index.js +0 -1
- package/node_modules/common/src/componentsMixins/mixins/activableMixin.js +0 -14
- package/node_modules/common/src/componentsMixins/mixins/changeMixin.js +0 -22
- package/node_modules/common/src/componentsMixins/mixins/componentNameValidationMixin.js +0 -23
- package/node_modules/common/src/componentsMixins/mixins/componentsContextMixin.js +0 -12
- package/node_modules/common/src/componentsMixins/mixins/createDynamicDataMixin.js +0 -100
- package/node_modules/common/src/componentsMixins/mixins/createProxy.js +0 -58
- package/node_modules/common/src/componentsMixins/mixins/createStyleMixin/helpers.js +0 -106
- package/node_modules/common/src/componentsMixins/mixins/createStyleMixin/index.js +0 -167
- package/node_modules/common/src/componentsMixins/mixins/draggableMixin.js +0 -62
- package/node_modules/common/src/componentsMixins/mixins/externalInputHelpers.js +0 -93
- package/node_modules/common/src/componentsMixins/mixins/externalInputMixin.js +0 -170
- package/node_modules/common/src/componentsMixins/mixins/hoverableMixin.js +0 -13
- package/node_modules/common/src/componentsMixins/mixins/index.js +0 -14
- package/node_modules/common/src/componentsMixins/mixins/inputEventsDispatchingMixin.js +0 -76
- package/node_modules/common/src/componentsMixins/mixins/inputValidationMixin.js +0 -210
- package/node_modules/common/src/componentsMixins/mixins/lifecycleEventsMixin.js +0 -23
- package/node_modules/common/src/componentsMixins/mixins/normalizeBooleanAttributesMixin.js +0 -59
- package/node_modules/common/src/componentsMixins/mixins/portalMixin.js +0 -112
- package/node_modules/common/src/componentsMixins/mixins/proxyInputMixin.js +0 -242
- package/node_modules/common/src/constants.js +0 -4
- package/node_modules/common/src/icons/errorMessageIconBase64.js +0 -1
- package/node_modules/common/src/sbControls.js +0 -302
- package/node_modules/common/src/sbHelpers.js +0 -53
- package/node_modules/common/src/themeHelpers/colorsHelpers.js +0 -94
- package/node_modules/common/src/themeHelpers/componentsThemeManager.js +0 -45
- package/node_modules/common/src/themeHelpers/index.js +0 -191
- package/node_modules/common/src/themeHelpers/resetHelpers.js +0 -144
- package/node_modules/common/src/utils/index.js +0 -68
- package/node_modules/descope-avatar/e2e/descope-avatar.spec.ts +0 -54
- package/node_modules/descope-avatar/package.json +0 -34
- package/node_modules/descope-avatar/project.json +0 -7
- package/node_modules/descope-avatar/src/component/AvatarClass.js +0 -109
- package/node_modules/descope-avatar/src/component/index.js +0 -8
- package/node_modules/descope-avatar/src/theme.js +0 -44
- package/node_modules/descope-avatar/stories/avatar.jpeg +0 -0
- package/node_modules/descope-avatar/stories/descope-avatar.stories.js +0 -32
- package/node_modules/descope-combo-box/e2e/descope-combo-box.spec.ts +0 -462
- package/node_modules/descope-combo-box/package.json +0 -34
- package/node_modules/descope-combo-box/project.json +0 -7
- package/node_modules/descope-combo-box/src/component/ComboBoxClass.js +0 -619
- package/node_modules/descope-combo-box/src/component/index.js +0 -6
- package/node_modules/descope-combo-box/src/theme.js +0 -93
- package/node_modules/descope-combo-box/stories/descope-combo-box.stories.js +0 -180
- package/node_modules/descope-text/e2e/descope-text.spec.ts +0 -35
- package/node_modules/descope-text/package.json +0 -31
- package/node_modules/descope-text/project.json +0 -7
- package/node_modules/descope-text/src/component/TextClass.js +0 -63
- package/node_modules/descope-text/src/component/index.js +0 -5
- package/node_modules/descope-text/src/theme.js +0 -91
- package/node_modules/descope-text/stories/descope-text.stories.js +0 -55
- package/node_modules/theme-globals/package.json +0 -16
- package/node_modules/theme-globals/project.json +0 -7
- package/node_modules/theme-globals/src/index.js +0 -180
- package/node_modules/theme-input-wrapper/package.json +0 -17
- package/node_modules/theme-input-wrapper/project.json +0 -7
- package/node_modules/theme-input-wrapper/src/index.js +0 -130
- package/src/index.d.ts +0 -72
@@ -1,93 +0,0 @@
|
|
1
|
-
import globals from 'theme-globals';
|
2
|
-
import { ComboBoxClass } from './component/ComboBoxClass';
|
3
|
-
import { getThemeRefs } from 'common/theme-helpers';
|
4
|
-
import { refs } from 'theme-input-wrapper';
|
5
|
-
|
6
|
-
const globalRefs = getThemeRefs(globals);
|
7
|
-
const vars = ComboBoxClass.cssVarList;
|
8
|
-
|
9
|
-
export const comboBox = {
|
10
|
-
[vars.hostWidth]: refs.width,
|
11
|
-
[vars.hostDirection]: refs.direction,
|
12
|
-
[vars.fontSize]: refs.fontSize,
|
13
|
-
[vars.fontFamily]: refs.fontFamily,
|
14
|
-
[vars.labelFontSize]: refs.labelFontSize,
|
15
|
-
[vars.labelFontWeight]: refs.labelFontWeight,
|
16
|
-
[vars.labelTextColor]: refs.labelTextColor,
|
17
|
-
[vars.errorMessageTextColor]: refs.errorMessageTextColor,
|
18
|
-
[vars.inputBorderColor]: refs.borderColor,
|
19
|
-
[vars.inputBorderWidth]: refs.borderWidth,
|
20
|
-
[vars.inputBorderStyle]: refs.borderStyle,
|
21
|
-
[vars.inputBorderRadius]: refs.borderRadius,
|
22
|
-
[vars.inputOutlineColor]: refs.outlineColor,
|
23
|
-
[vars.inputOutlineOffset]: refs.outlineOffset,
|
24
|
-
[vars.inputOutlineWidth]: refs.outlineWidth,
|
25
|
-
[vars.inputOutlineStyle]: refs.outlineStyle,
|
26
|
-
[vars.labelRequiredIndicator]: refs.requiredIndicator,
|
27
|
-
[vars.inputValueTextColor]: refs.valueTextColor,
|
28
|
-
[vars.inputPlaceholderTextColor]: refs.placeholderTextColor,
|
29
|
-
[vars.inputBackgroundColor]: refs.backgroundColor,
|
30
|
-
[vars.inputHorizontalPadding]: refs.horizontalPadding,
|
31
|
-
[vars.inputHeight]: refs.inputHeight,
|
32
|
-
[vars.inputDropdownButtonColor]: globalRefs.colors.surface.dark,
|
33
|
-
[vars.inputDropdownButtonCursor]: 'pointer',
|
34
|
-
[vars.inputDropdownButtonSize]: refs.toggleButtonSize,
|
35
|
-
[vars.inputDropdownButtonOffset]: globalRefs.spacing.xs,
|
36
|
-
[vars.overlayItemPaddingInlineStart]: globalRefs.spacing.xs,
|
37
|
-
[vars.overlayItemPaddingInlineEnd]: globalRefs.spacing.lg,
|
38
|
-
[vars.labelPosition]: refs.labelPosition,
|
39
|
-
[vars.labelTopPosition]: refs.labelTopPosition,
|
40
|
-
[vars.labelHorizontalPosition]: refs.labelHorizontalPosition,
|
41
|
-
[vars.inputTransformY]: refs.inputTransformY,
|
42
|
-
[vars.inputTransition]: refs.inputTransition,
|
43
|
-
[vars.marginInlineStart]: refs.marginInlineStart,
|
44
|
-
[vars.placeholderOpacity]: refs.placeholderOpacity,
|
45
|
-
[vars.inputVerticalAlignment]: refs.inputVerticalAlignment,
|
46
|
-
[vars.valueInputHeight]: refs.valueInputHeight,
|
47
|
-
[vars.valueInputMarginBottom]: refs.valueInputMarginBottom,
|
48
|
-
|
49
|
-
// error message icon
|
50
|
-
[vars.errorMessageIcon]: refs.errorMessageIcon,
|
51
|
-
[vars.errorMessageIconSize]: refs.errorMessageIconSize,
|
52
|
-
[vars.errorMessageIconPadding]: refs.errorMessageIconPadding,
|
53
|
-
[vars.errorMessageIconRepeat]: refs.errorMessageIconRepeat,
|
54
|
-
[vars.errorMessageIconPosition]: refs.errorMessageIconPosition,
|
55
|
-
|
56
|
-
_readonly: {
|
57
|
-
[vars.inputDropdownButtonCursor]: 'default',
|
58
|
-
},
|
59
|
-
|
60
|
-
// Overlay theme exposed via the component:
|
61
|
-
[vars.overlayFontSize]: refs.fontSize,
|
62
|
-
[vars.overlayFontFamily]: refs.fontFamily,
|
63
|
-
[vars.overlayCursor]: 'pointer',
|
64
|
-
[vars.overlayItemBoxShadow]: 'none',
|
65
|
-
[vars.overlayBackground]: refs.backgroundColor,
|
66
|
-
[vars.overlayTextColor]: refs.valueTextColor,
|
67
|
-
|
68
|
-
// Overlay direct theme:
|
69
|
-
[vars.overlay.minHeight]: '400px',
|
70
|
-
[vars.overlay.margin]: '0',
|
71
|
-
|
72
|
-
[vars.overlay.contentHeight]: '100%',
|
73
|
-
[vars.overlay.contentOpacity]: '1',
|
74
|
-
_loading: {
|
75
|
-
[vars.overlay.loaderTop]: '50%',
|
76
|
-
[vars.overlay.loaderLeft]: '50%',
|
77
|
-
[vars.overlay.loaderRight]: 'auto',
|
78
|
-
// Margin has to be negative to center the loader, "transform" can't be used because the animation uses it
|
79
|
-
// Margin has to be half of the width/height of the loader to center it
|
80
|
-
[vars.overlay.loaderMargin]: '-15px 0 0 -15px',
|
81
|
-
[vars.overlay.loaderWidth]: '30px',
|
82
|
-
[vars.overlay.loaderHeight]: '30px',
|
83
|
-
[vars.overlay.loaderBorder]: '2px solid transparent',
|
84
|
-
[vars.overlay
|
85
|
-
.loaderBorderColor]: `${globalRefs.colors.primary.highlight} ${globalRefs.colors.primary.highlight} ${globalRefs.colors.primary.main} ${globalRefs.colors.primary.main}`,
|
86
|
-
[vars.overlay.loaderBorderRadius]: '50%',
|
87
|
-
[vars.overlay.contentHeight]: '100px',
|
88
|
-
[vars.overlay.contentOpacity]: '0',
|
89
|
-
},
|
90
|
-
};
|
91
|
-
|
92
|
-
export default comboBox;
|
93
|
-
export { vars };
|
@@ -1,180 +0,0 @@
|
|
1
|
-
/* eslint no-param-reassign: 0 */
|
2
|
-
|
3
|
-
import { componentName } from '../src/component/ComboBoxClass';
|
4
|
-
import { withForm } from 'common/sb-helpers';
|
5
|
-
import {
|
6
|
-
labelControl,
|
7
|
-
placeholderControl,
|
8
|
-
sizeControl,
|
9
|
-
fullWidthControl,
|
10
|
-
directionControl,
|
11
|
-
disabledControl,
|
12
|
-
readOnlyControl,
|
13
|
-
requiredControl,
|
14
|
-
borderedControl,
|
15
|
-
loadingControl,
|
16
|
-
errorMissingValueControl,
|
17
|
-
overrideRenderItemControl,
|
18
|
-
itemsSourceControl,
|
19
|
-
inputLabelTypeControl,
|
20
|
-
errorMessageIconControl,
|
21
|
-
errorMessageIconAttrs,
|
22
|
-
} from 'common/sb-controls';
|
23
|
-
|
24
|
-
const Template = ({
|
25
|
-
label,
|
26
|
-
placeholder,
|
27
|
-
size,
|
28
|
-
bordered,
|
29
|
-
'full-width': fullWidth,
|
30
|
-
readonly,
|
31
|
-
required,
|
32
|
-
direction,
|
33
|
-
disabled,
|
34
|
-
data,
|
35
|
-
overrideRenderItem,
|
36
|
-
itemsSource,
|
37
|
-
loading,
|
38
|
-
'default-value': defaultValue,
|
39
|
-
'data-errormessage-value-missing': customErrorMissingValue,
|
40
|
-
'label-type': labelType,
|
41
|
-
'hide-toggle-button': hideToggleButton,
|
42
|
-
'allow-custom-value': allowCustomValue,
|
43
|
-
overrideRenderer,
|
44
|
-
errorMsgIcon,
|
45
|
-
}) => {
|
46
|
-
let serializedData;
|
47
|
-
|
48
|
-
try {
|
49
|
-
serializedData = JSON.stringify(data);
|
50
|
-
} catch (e) {
|
51
|
-
// do nothing
|
52
|
-
}
|
53
|
-
|
54
|
-
// this is another way to pass data to the component (prop instead of attr)
|
55
|
-
const dataFromPropScript = `
|
56
|
-
<script>
|
57
|
-
document.querySelector("descope-combo-box").data = ${serializedData.replace(
|
58
|
-
/\n/g,
|
59
|
-
'',
|
60
|
-
)}
|
61
|
-
</script>`;
|
62
|
-
|
63
|
-
// eslint-disable-next-line no-shadow
|
64
|
-
const altRenderItem = ({ displayName, label, value }) =>
|
65
|
-
`<span data-name="${displayName}" data-value="${value}">${label}</span>`;
|
66
|
-
|
67
|
-
// this allows us to update the render item function
|
68
|
-
const overrideRenderItemScript = `
|
69
|
-
<script>
|
70
|
-
document.querySelector("descope-combo-box").renderItem = ${altRenderItem
|
71
|
-
.toString()
|
72
|
-
.replace(/\n/g, '')}
|
73
|
-
</script>`;
|
74
|
-
|
75
|
-
const altRenderer = (root, combo, model) => {
|
76
|
-
if (model.index === 1) {
|
77
|
-
root.style.backgroundColor = '#008000';
|
78
|
-
root.style.color = '#ffffff';
|
79
|
-
}
|
80
|
-
root.innerHTML = model.item.outerHTML;
|
81
|
-
};
|
82
|
-
|
83
|
-
const overrideRendererScript = `
|
84
|
-
<script>
|
85
|
-
document.querySelector("descope-combo-box").renderer = ${altRenderer
|
86
|
-
.toString()
|
87
|
-
.replace(/\n/g, '')}
|
88
|
-
</script>`;
|
89
|
-
|
90
|
-
return withForm(`
|
91
|
-
<descope-combo-box
|
92
|
-
clear-button-visible
|
93
|
-
data='${(itemsSource === 'attr' && serializedData) || ''}'
|
94
|
-
size="${size}"
|
95
|
-
bordered="${bordered}"
|
96
|
-
item-label-path="data-name"
|
97
|
-
item-value-path="data-id"
|
98
|
-
label="${label || ''}"
|
99
|
-
placeholder="${placeholder || ''}"
|
100
|
-
default-value="${defaultValue || ''}"
|
101
|
-
required="${required || false}"
|
102
|
-
full-width="${fullWidth || false}"
|
103
|
-
readonly="${readonly || false}"
|
104
|
-
disabled="${disabled || false}"
|
105
|
-
loading="${loading || false}"
|
106
|
-
data-errormessage-value-missing="${customErrorMissingValue || ''}"
|
107
|
-
st-host-direction="${direction ?? ''}"
|
108
|
-
label-type="${labelType || ''}"
|
109
|
-
hide-toggle-button="${hideToggleButton || false}"
|
110
|
-
allow-custom-value="${allowCustomValue || false}"
|
111
|
-
${errorMsgIcon ? errorMessageIconAttrs : ''}
|
112
|
-
>
|
113
|
-
<span data-name="ItemName1" data-id="itemId1">Trojan War Heroes' Valor</span>
|
114
|
-
<span data-name="ItemName2" data-id="itemId2">Achilles' Fateful Wrath</span>
|
115
|
-
<span data-name="ItemName3" data-id="itemId3">Epic Battle of Gods</span>
|
116
|
-
<span data-name="ItemName4" data-id="itemId4">Hector's Brave Sacrifice</span>
|
117
|
-
<span data-name="ItemName5" data-id="itemId5">Trojan Horse Deception</span>
|
118
|
-
<span data-name="ItemName6" data-id="itemId6">Agamemnon's Royal Command</span>
|
119
|
-
<span data-name="ItemName7" data-id="itemId7">Odysseus' Cunning Strategy</span>
|
120
|
-
<span data-name="ItemName8" data-id="itemId8">Helen's Beauty's Curse</span>
|
121
|
-
<span data-name="ItemName9" data-id="itemId9">Achilles' Heel Weakness</span>
|
122
|
-
<span data-name="ItemName10" data-id="itemId10">Epic Poem of Ancient</span>
|
123
|
-
</descope-combo-box>
|
124
|
-
${itemsSource === 'prop' ? dataFromPropScript : ''}
|
125
|
-
${overrideRenderItem ? overrideRenderItemScript : ''}
|
126
|
-
${overrideRenderer ? overrideRendererScript : ''}
|
127
|
-
`);
|
128
|
-
};
|
129
|
-
|
130
|
-
export default {
|
131
|
-
component: componentName,
|
132
|
-
title: 'descope-combo-box',
|
133
|
-
argTypes: {
|
134
|
-
...labelControl,
|
135
|
-
...placeholderControl,
|
136
|
-
...inputLabelTypeControl,
|
137
|
-
...sizeControl,
|
138
|
-
...fullWidthControl,
|
139
|
-
...disabledControl,
|
140
|
-
...readOnlyControl,
|
141
|
-
...requiredControl,
|
142
|
-
...borderedControl,
|
143
|
-
...errorMissingValueControl,
|
144
|
-
...overrideRenderItemControl,
|
145
|
-
...itemsSourceControl,
|
146
|
-
...directionControl,
|
147
|
-
...loadingControl,
|
148
|
-
...errorMessageIconControl,
|
149
|
-
'default-value': {
|
150
|
-
name: 'Default Value',
|
151
|
-
control: { type: 'text' },
|
152
|
-
},
|
153
|
-
'hide-toggle-button': {
|
154
|
-
name: 'Hide Toggle Button',
|
155
|
-
control: { type: 'boolean' },
|
156
|
-
},
|
157
|
-
'allow-custom-value': {
|
158
|
-
name: 'Allow Custom Value',
|
159
|
-
control: { type: 'boolean' },
|
160
|
-
},
|
161
|
-
overrideRenderer: {
|
162
|
-
name: 'Override the default renderer function',
|
163
|
-
control: { type: 'boolean' },
|
164
|
-
},
|
165
|
-
},
|
166
|
-
};
|
167
|
-
|
168
|
-
export const Default = Template.bind({});
|
169
|
-
|
170
|
-
Default.args = {
|
171
|
-
size: 'md',
|
172
|
-
bordered: true,
|
173
|
-
loading: false,
|
174
|
-
data: [
|
175
|
-
{ displayName: 'Item1', value: '1', label: 'data item 1' },
|
176
|
-
{ displayName: 'Item2', value: 'itemId2', label: 'data item 2' },
|
177
|
-
{ displayName: 'Item3', value: '3', label: 'data item 3' },
|
178
|
-
{ displayName: 'Item4', value: '4', label: 'data item 4' },
|
179
|
-
],
|
180
|
-
};
|
@@ -1,35 +0,0 @@
|
|
1
|
-
import { test, expect } from '@playwright/test';
|
2
|
-
import { getStoryUrl, loopConfig } from 'e2e-utils';
|
3
|
-
|
4
|
-
const componentAttributes = {
|
5
|
-
text: 'Test Text',
|
6
|
-
variant: ['h1', 'h2', 'h3', 'subtitle1', 'subtitle2', 'body1', 'body2'],
|
7
|
-
mode: ['primary', 'secondary', 'success', 'error'],
|
8
|
-
'text-align': ['left', 'center', 'right'],
|
9
|
-
'hide-when-empty': ['true'],
|
10
|
-
};
|
11
|
-
|
12
|
-
const storyName = 'descope-text';
|
13
|
-
const componentName = 'descope-text';
|
14
|
-
|
15
|
-
test.describe('theme', () => {
|
16
|
-
loopConfig(componentAttributes, (attr, value) => {
|
17
|
-
test(`${attr}: ${value}`, async ({ page }) => {
|
18
|
-
await page.goto(getStoryUrl(storyName, { [attr]: value }));
|
19
|
-
const component = page.locator(componentName);
|
20
|
-
expect(await component.screenshot()).toMatchSnapshot();
|
21
|
-
});
|
22
|
-
});
|
23
|
-
|
24
|
-
test(`full-width: false`, async ({ page }) => {
|
25
|
-
await page.goto(getStoryUrl(storyName, { 'full-width': false }));
|
26
|
-
const component = page.locator(componentName);
|
27
|
-
expect(await component.screenshot()).toMatchSnapshot();
|
28
|
-
});
|
29
|
-
|
30
|
-
test(`direction: rtl`, async ({ page }) => {
|
31
|
-
await page.goto(getStoryUrl(storyName, { direction: 'rtl', text: '-Hello World' }));
|
32
|
-
const component = page.locator(componentName);
|
33
|
-
expect(await component.screenshot()).toMatchSnapshot();
|
34
|
-
});
|
35
|
-
});
|
@@ -1,31 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "descope-text",
|
3
|
-
"version": "0.0.1",
|
4
|
-
"exports": {
|
5
|
-
".": {
|
6
|
-
"import": "./src/component/index.js"
|
7
|
-
},
|
8
|
-
"./theme": {
|
9
|
-
"import": "./src/theme.js"
|
10
|
-
},
|
11
|
-
"./class": {
|
12
|
-
"import": "./src/component/TextClass.js"
|
13
|
-
}
|
14
|
-
},
|
15
|
-
"scripts": {
|
16
|
-
"test": "echo 'No tests defined' && exit 0",
|
17
|
-
"test:e2e": "echo 'No e2e tests defined' && exit 0"
|
18
|
-
},
|
19
|
-
"devDependencies": {
|
20
|
-
"e2e-utils": "workspace:*",
|
21
|
-
"@playwright/test": "1.38.1"
|
22
|
-
},
|
23
|
-
"dependencies": {
|
24
|
-
"common": "0.0.1",
|
25
|
-
"theme-globals": "0.0.1"
|
26
|
-
},
|
27
|
-
"private": true,
|
28
|
-
"publishConfig": {
|
29
|
-
"link-workspace-packages": false
|
30
|
-
}
|
31
|
-
}
|
@@ -1,63 +0,0 @@
|
|
1
|
-
import { createStyleMixin, draggableMixin, componentNameValidationMixin } from 'common/components-mixins';
|
2
|
-
import { compose } from 'common/utils';
|
3
|
-
import { getComponentName, observeChildren } from 'common/components-helpers';
|
4
|
-
import { createBaseClass } from 'common/base-classes';
|
5
|
-
|
6
|
-
export const componentName = getComponentName('text');
|
7
|
-
|
8
|
-
class RawText extends createBaseClass({ componentName, baseSelector: ':host > slot' }) {
|
9
|
-
constructor() {
|
10
|
-
super();
|
11
|
-
|
12
|
-
this.attachShadow({ mode: 'open' }).innerHTML = `
|
13
|
-
<style>
|
14
|
-
:host {
|
15
|
-
display: inline-block;
|
16
|
-
line-height: 1em;
|
17
|
-
}
|
18
|
-
:host > slot {
|
19
|
-
width: 100%;
|
20
|
-
display: inline-block;
|
21
|
-
}
|
22
|
-
</style>
|
23
|
-
<slot part="text-wrapper"></slot>
|
24
|
-
`;
|
25
|
-
}
|
26
|
-
|
27
|
-
get hideWhenEmpty() {
|
28
|
-
return this.getAttribute('hide-when-empty') === 'true';
|
29
|
-
}
|
30
|
-
|
31
|
-
init() {
|
32
|
-
super.init();
|
33
|
-
|
34
|
-
observeChildren(this, () => {
|
35
|
-
const hasChildren = !!this.childNodes.length;
|
36
|
-
this.style.display = !hasChildren && this.hideWhenEmpty ? 'none' : '';
|
37
|
-
});
|
38
|
-
}
|
39
|
-
}
|
40
|
-
|
41
|
-
export const TextClass = compose(
|
42
|
-
createStyleMixin({
|
43
|
-
mappings: {
|
44
|
-
hostWidth: { selector: () => ':host', property: 'width' },
|
45
|
-
hostDirection: { selector: () => ':host', property: 'direction' },
|
46
|
-
fontSize: {},
|
47
|
-
textColor: { property: 'color' },
|
48
|
-
textLineHeight: { property: 'line-height' },
|
49
|
-
textLetterSpacing: { property: 'letter-spacing' },
|
50
|
-
textShadow: {},
|
51
|
-
textAlign: {},
|
52
|
-
textTransform: {},
|
53
|
-
fontFamily: {},
|
54
|
-
fontStyle: {},
|
55
|
-
fontWeight: {},
|
56
|
-
borderWidth: {},
|
57
|
-
borderStyle: {},
|
58
|
-
borderColor: {},
|
59
|
-
},
|
60
|
-
}),
|
61
|
-
draggableMixin,
|
62
|
-
componentNameValidationMixin
|
63
|
-
)(RawText);
|
@@ -1,91 +0,0 @@
|
|
1
|
-
import globals from 'theme-globals';
|
2
|
-
import { getThemeRefs } from 'common/theme-helpers';
|
3
|
-
import { TextClass } from './component/TextClass';
|
4
|
-
|
5
|
-
const globalRefs = getThemeRefs(globals);
|
6
|
-
const vars = TextClass.cssVarList;
|
7
|
-
|
8
|
-
const text = {
|
9
|
-
[vars.hostDirection]: globalRefs.direction,
|
10
|
-
[vars.textLineHeight]: '1.35em',
|
11
|
-
[vars.textAlign]: 'left',
|
12
|
-
[vars.textColor]: globalRefs.colors.surface.dark,
|
13
|
-
|
14
|
-
variant: {
|
15
|
-
h1: {
|
16
|
-
[vars.fontSize]: globalRefs.typography.h1.size,
|
17
|
-
[vars.fontWeight]: globalRefs.typography.h1.weight,
|
18
|
-
[vars.fontFamily]: globalRefs.typography.h1.font,
|
19
|
-
},
|
20
|
-
h2: {
|
21
|
-
[vars.fontSize]: globalRefs.typography.h2.size,
|
22
|
-
[vars.fontWeight]: globalRefs.typography.h2.weight,
|
23
|
-
[vars.fontFamily]: globalRefs.typography.h2.font,
|
24
|
-
},
|
25
|
-
h3: {
|
26
|
-
[vars.fontSize]: globalRefs.typography.h3.size,
|
27
|
-
[vars.fontWeight]: globalRefs.typography.h3.weight,
|
28
|
-
[vars.fontFamily]: globalRefs.typography.h3.font,
|
29
|
-
},
|
30
|
-
subtitle1: {
|
31
|
-
[vars.fontSize]: globalRefs.typography.subtitle1.size,
|
32
|
-
[vars.fontWeight]: globalRefs.typography.subtitle1.weight,
|
33
|
-
[vars.fontFamily]: globalRefs.typography.subtitle1.font,
|
34
|
-
},
|
35
|
-
subtitle2: {
|
36
|
-
[vars.fontSize]: globalRefs.typography.subtitle2.size,
|
37
|
-
[vars.fontWeight]: globalRefs.typography.subtitle2.weight,
|
38
|
-
[vars.fontFamily]: globalRefs.typography.subtitle2.font,
|
39
|
-
},
|
40
|
-
body1: {
|
41
|
-
[vars.fontSize]: globalRefs.typography.body1.size,
|
42
|
-
[vars.fontWeight]: globalRefs.typography.body1.weight,
|
43
|
-
[vars.fontFamily]: globalRefs.typography.body1.font,
|
44
|
-
},
|
45
|
-
body2: {
|
46
|
-
[vars.fontSize]: globalRefs.typography.body2.size,
|
47
|
-
[vars.fontWeight]: globalRefs.typography.body2.weight,
|
48
|
-
[vars.fontFamily]: globalRefs.typography.body2.font,
|
49
|
-
},
|
50
|
-
},
|
51
|
-
|
52
|
-
mode: {
|
53
|
-
primary: {
|
54
|
-
[vars.textColor]: globalRefs.colors.surface.contrast,
|
55
|
-
},
|
56
|
-
secondary: {
|
57
|
-
[vars.textColor]: globalRefs.colors.surface.dark,
|
58
|
-
},
|
59
|
-
error: {
|
60
|
-
[vars.textColor]: globalRefs.colors.error.main,
|
61
|
-
},
|
62
|
-
success: {
|
63
|
-
[vars.textColor]: globalRefs.colors.success.main,
|
64
|
-
},
|
65
|
-
},
|
66
|
-
|
67
|
-
textAlign: {
|
68
|
-
right: { [vars.textAlign]: 'right' },
|
69
|
-
left: { [vars.textAlign]: 'left' },
|
70
|
-
center: { [vars.textAlign]: 'center' },
|
71
|
-
},
|
72
|
-
|
73
|
-
_fullWidth: {
|
74
|
-
[vars.hostWidth]: '100%',
|
75
|
-
},
|
76
|
-
|
77
|
-
_italic: {
|
78
|
-
[vars.fontStyle]: 'italic',
|
79
|
-
},
|
80
|
-
|
81
|
-
_uppercase: {
|
82
|
-
[vars.textTransform]: 'uppercase',
|
83
|
-
},
|
84
|
-
|
85
|
-
_lowercase: {
|
86
|
-
[vars.textTransform]: 'lowercase',
|
87
|
-
},
|
88
|
-
};
|
89
|
-
|
90
|
-
export default text;
|
91
|
-
export { vars };
|
@@ -1,55 +0,0 @@
|
|
1
|
-
import { componentName } from '../src/component/TextClass';
|
2
|
-
import {
|
3
|
-
textContentControl,
|
4
|
-
textAlignControl,
|
5
|
-
modeControl,
|
6
|
-
fullWidthControl,
|
7
|
-
typographyVariantControl,
|
8
|
-
directionControl,
|
9
|
-
} from 'common/sb-controls';
|
10
|
-
|
11
|
-
const Template = ({
|
12
|
-
variant,
|
13
|
-
mode,
|
14
|
-
'text-align': textAlign,
|
15
|
-
'full-width': fullWidth,
|
16
|
-
text,
|
17
|
-
'hide-when-empty': hideWhenEmpty,
|
18
|
-
direction,
|
19
|
-
}) => `
|
20
|
-
<descope-text
|
21
|
-
mode="${mode || ''}"
|
22
|
-
variant="${variant || ''}"
|
23
|
-
full-width="${fullWidth || false}"
|
24
|
-
text-align="${textAlign}"
|
25
|
-
hide-when-empty="${hideWhenEmpty}"
|
26
|
-
st-host-direction="${direction ?? ''}"
|
27
|
-
>${text}</descope-text>
|
28
|
-
`;
|
29
|
-
|
30
|
-
export default {
|
31
|
-
component: componentName,
|
32
|
-
title: 'descope-text',
|
33
|
-
parameters: {
|
34
|
-
panelPosition: 'right',
|
35
|
-
controls: { expanded: true },
|
36
|
-
},
|
37
|
-
argTypes: {
|
38
|
-
...textContentControl,
|
39
|
-
...modeControl,
|
40
|
-
...textAlignControl,
|
41
|
-
...fullWidthControl,
|
42
|
-
...typographyVariantControl,
|
43
|
-
...directionControl,
|
44
|
-
},
|
45
|
-
};
|
46
|
-
|
47
|
-
export const Default = Template.bind({});
|
48
|
-
|
49
|
-
Default.args = {
|
50
|
-
text: 'Lorem Ipsum',
|
51
|
-
variant: 'h1',
|
52
|
-
mode: 'primary',
|
53
|
-
'hide-when-empty': false,
|
54
|
-
fullWidth: true, // full-width is true by default for test purposes, which expect this as default and test the FALSE override only
|
55
|
-
};
|
@@ -1,16 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "theme-globals",
|
3
|
-
"version": "0.0.1",
|
4
|
-
"main": "./src/index.js",
|
5
|
-
"scripts": {
|
6
|
-
"test": "echo 'No tests defined' && exit 0",
|
7
|
-
"test:e2e": "echo 'No e2e tests defined' && exit 0"
|
8
|
-
},
|
9
|
-
"dependencies": {
|
10
|
-
"common": "0.0.1"
|
11
|
-
},
|
12
|
-
"private": true,
|
13
|
-
"publishConfig": {
|
14
|
-
"link-workspace-packages": false
|
15
|
-
}
|
16
|
-
}
|