@descope-ui/descope-apps-list 0.0.1

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/CHANGELOG.md ADDED
@@ -0,0 +1,15 @@
1
+ # Changelog
2
+
3
+ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
+
5
+ ## 0.0.1 (2025-07-21)
6
+
7
+ ### Dependency Updates
8
+
9
+ * `e2e-utils` updated to version `0.0.1`
10
+ * `@descope-ui/common` updated to version `0.0.18`
11
+ * `@descope-ui/theme-globals` updated to version `0.0.19`
12
+ * `@descope-ui/descope-list` updated to version `0.0.1`
13
+ * `@descope-ui/descope-avatar` updated to version `0.0.19`
14
+ * `@descope-ui/descope-text` updated to version `0.0.19`
15
+ # Changelog
@@ -0,0 +1,27 @@
1
+ import { test, expect } from '@playwright/test';
2
+ import { getStoryUrl, loopConfig } from 'e2e-utils';
3
+
4
+ const componentAttributes = {
5
+ direction: ['ltr', 'rtl'],
6
+ numberOfItems: ['0'],
7
+ size: ['xs', 'sm', 'md', 'lg'],
8
+ variant: ['list', 'tiles'],
9
+ };
10
+
11
+ const storyName = 'descope-apps-list';
12
+ const componentName = 'descope-apps-list';
13
+
14
+ test.describe('theme', () => {
15
+ loopConfig(componentAttributes, (attr, value) => {
16
+ test.describe(`${attr}: ${value}`, () => {
17
+ test.beforeEach(async ({ page }) => {
18
+ await page.goto(getStoryUrl(storyName, { [attr]: value }), { waitUntil: 'networkidle' });
19
+ });
20
+ test('style', async ({ page }) => {
21
+ const componentParent = page.locator(componentName);
22
+
23
+ expect(await componentParent.screenshot()).toMatchSnapshot();
24
+ });
25
+ });
26
+ });
27
+ });
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@descope-ui/descope-apps-list",
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/AppsListClass.js"
13
+ }
14
+ },
15
+ "devDependencies": {
16
+ "@playwright/test": "1.38.1",
17
+ "e2e-utils": "0.0.1"
18
+ },
19
+ "dependencies": {
20
+ "@descope-ui/common": "0.0.18",
21
+ "@descope-ui/theme-globals": "0.0.19",
22
+ "@descope-ui/descope-list": "0.0.1",
23
+ "@descope-ui/descope-avatar": "0.0.19",
24
+ "@descope-ui/descope-text": "0.0.19"
25
+ },
26
+ "publishConfig": {
27
+ "link-workspace-packages": false
28
+ },
29
+ "scripts": {
30
+ "test": "echo 'No tests defined' && exit 0",
31
+ "test:e2e": "echo 'No e2e tests defined' && exit 0"
32
+ }
33
+ }
package/project.json ADDED
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "@descope-ui/descope-apps-list",
3
+ "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
+ "sourceRoot": "packages/web-components/components/descope-apps-list/src",
5
+ "projectType": "library",
6
+ "targets": {
7
+ "version": {
8
+ "executor": "@jscutlery/semver:version",
9
+ "options": {
10
+ "trackDeps": true,
11
+ "push": false,
12
+ "preset": "conventional"
13
+ }
14
+ }
15
+ },
16
+ "tags": []
17
+ }
@@ -0,0 +1,89 @@
1
+ import { compose } from '@descope-ui/common/utils';
2
+ import { getComponentName, limitAbbreviation } from '@descope-ui/common/components-helpers';
3
+ import {
4
+ createStyleMixin,
5
+ draggableMixin,
6
+ createProxy,
7
+ componentNameValidationMixin,
8
+ createDynamicDataMixin,
9
+ } from '@descope-ui/common/components-mixins';
10
+ import { TextClass } from '@descope-ui/descope-text/class';
11
+
12
+ export const componentName = getComponentName('apps-list');
13
+
14
+ const itemRenderer = ({ name, icon, url }, _, ref) => `
15
+ <a ${url ? `href="${url}" title="${url}"` : ''} target="_blank">
16
+ <descope-list-item>
17
+ <descope-avatar
18
+ ${icon ? `img="${icon}"` : ''}
19
+ ${name ? `display-name="${name}" abbr=${limitAbbreviation(name)}` : ''}
20
+ size=${ref.size}
21
+ ></descope-avatar>
22
+ <descope-text
23
+ variant="body1"
24
+ mode="primary"
25
+ >${name}</descope-text>
26
+ </descope-list-item>
27
+ </a>
28
+ `;
29
+
30
+ const customMixin = (superclass) =>
31
+ class AppsListMixinClass extends superclass {
32
+ get size() {
33
+ return this.getAttribute('size') || 'sm';
34
+ }
35
+ };
36
+
37
+ export const AppsListClass = compose(
38
+ createStyleMixin({
39
+ mappings: {
40
+ maxHeight: { selector: () => ':host' },
41
+ minHeight: { selector: () => ':host' },
42
+ hostDirection: { selector: () => ':host', property: 'direction' },
43
+ itemsFontWeight: {
44
+ selector: TextClass.componentName,
45
+ property: TextClass.cssVarList.fontWeight,
46
+ },
47
+ itemsFontSize: {
48
+ selector: TextClass.componentName,
49
+ property: TextClass.cssVarList.fontSize,
50
+ },
51
+ itemsTextAlign: {
52
+ selector: TextClass.componentName,
53
+ property: TextClass.cssVarList.textAlign,
54
+ },
55
+ },
56
+ }),
57
+ createDynamicDataMixin({ itemRenderer, rerenderAttrsList: ['size'] }),
58
+ draggableMixin,
59
+ componentNameValidationMixin,
60
+ customMixin
61
+ )(
62
+ createProxy({
63
+ slots: ['empty-state'],
64
+ wrappedEleName: 'descope-list',
65
+ excludeAttrsSync: ['tabindex', 'class', 'empty'],
66
+ componentName,
67
+ style: () => `
68
+ :host {
69
+ width: 100%;
70
+ display: inline-flex;
71
+ }
72
+
73
+ descope-text::part(text-wrapper) {
74
+ display: -webkit-box;
75
+ -webkit-line-clamp: 2;
76
+ -webkit-box-orient: vertical;
77
+ overflow: hidden;
78
+ }
79
+
80
+ a {
81
+ text-decoration: none;
82
+ }
83
+
84
+ descope-text {
85
+ ${TextClass.cssVarList.hostDirection}: var(${AppsListClass.cssVarList.hostDirection});
86
+ }
87
+ `,
88
+ })
89
+ );
@@ -0,0 +1,8 @@
1
+ import '@descope-ui/descope-list';
2
+ import '@descope-ui/descope-avatar';
3
+ import '@descope-ui/descope-text';
4
+ import { componentName, AppsListClass } from './AppsListClass';
5
+
6
+ customElements.define(componentName, AppsListClass);
7
+
8
+ export { AppsListClass, componentName };
package/src/theme.js ADDED
@@ -0,0 +1,36 @@
1
+ import { AppsListClass } from './component/AppsListClass';
2
+ import { getThemeRefs } from '@descope-ui/common/theme-helpers';
3
+ import globals from '@descope-ui/theme-globals';
4
+
5
+ export const vars = AppsListClass.cssVarList;
6
+ const globalRefs = getThemeRefs(globals);
7
+
8
+ const defaultHeight = '400px';
9
+
10
+ const appsList = {
11
+ [vars.itemsFontWeight]: 'normal',
12
+ [vars.itemsTextAlign]: 'start',
13
+ [vars.hostDirection]: globalRefs.direction,
14
+ [vars.maxHeight]: defaultHeight,
15
+
16
+ _empty: {
17
+ [vars.minHeight]: defaultHeight,
18
+ },
19
+
20
+ size: {
21
+ xs: {
22
+ [vars.itemsFontSize]: '14px',
23
+ },
24
+ sm: {
25
+ [vars.itemsFontSize]: '14px',
26
+ },
27
+ md: {
28
+ [vars.itemsFontSize]: '16px',
29
+ },
30
+ lg: {
31
+ [vars.itemsFontSize]: '20px',
32
+ },
33
+ },
34
+ };
35
+
36
+ export default appsList;
Binary file
@@ -0,0 +1,57 @@
1
+ import { componentName } from '../src/component';
2
+ import { directionControl, sizeControl } from '@descope-ui/common/sb-controls';
3
+ import avatarImage from './avatar.jpeg';
4
+
5
+ const Template = ({
6
+ direction,
7
+ emptyState,
8
+ size,
9
+ variant,
10
+ }) => `
11
+ <descope-apps-list
12
+ st-host-direction="${direction || ''}"
13
+ size=${size || ''}
14
+ variant="${variant}"
15
+ >
16
+ <div slot="empty-state">${emptyState}</div>
17
+ </descope-apps-list>
18
+ `;
19
+
20
+ export default {
21
+ component: componentName,
22
+ title: 'descope-apps-list',
23
+ decorators: [
24
+ (story, { args }) => {
25
+ setTimeout(() => {
26
+ document.querySelector('descope-apps-list').data = Array.from(
27
+ { length: args.numberOfItems },
28
+ (_, i) => ({
29
+ name: `${args.itemSampleText} ${i + 1}`,
30
+ icon: i % 2 > 0 ? avatarImage : '',
31
+ url: 'https://www.google.com',
32
+ })
33
+ );
34
+ });
35
+ return story();
36
+ },
37
+ ],
38
+ argTypes: {
39
+ ...directionControl,
40
+ ...sizeControl,
41
+ variant: {
42
+ name: 'Variant',
43
+ options: ['list', 'tiles'],
44
+ control: { type: 'radio' },
45
+ },
46
+ },
47
+ };
48
+
49
+ export const Default = Template.bind({});
50
+
51
+ Default.args = {
52
+ size: 'sm',
53
+ variant: 'list',
54
+ numberOfItems: 10,
55
+ itemSampleText: 'Sample application display name',
56
+ emptyState: 'No items in the list...',
57
+ };