@spscommerce/ds-shared 0.1.0

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.
@@ -0,0 +1,26 @@
1
+ import type { MetadataProperty } from "@spscommerce/utils";
2
+ /**
3
+ * Metadata describing an "action" that can be passed in
4
+ * to components such as modal and select.
5
+ */
6
+ export interface SpsActionDescriptor {
7
+ label?: MetadataProperty<string>;
8
+ icon?: MetadataProperty<string>;
9
+ caption?: MetadataProperty<string>;
10
+ disabled?: MetadataProperty<boolean>;
11
+ isLink?: MetadataProperty<boolean>;
12
+ href?: MetadataProperty<string>;
13
+ newTab?: MetadataProperty<boolean>;
14
+ }
15
+ export declare const SPS_ACTION_DEFAULTS: SpsActionDescriptor;
16
+ /** A method that has been decorated with `@SpsAction`. */
17
+ export interface SpsActionMethod extends SpsActionDescriptor {
18
+ (...args: any[]): any;
19
+ }
20
+ /**
21
+ * Attaches metadata to the decorated method, designating it as an "action"
22
+ * that can be passed in to components such as modal and select. For example,
23
+ * if passed in to the modal, a button will be rendered in the modal using the
24
+ * specified label, icon, etc, and clicking that button will call the method.
25
+ */
26
+ export declare function SpsAction(actionDescriptor: SpsActionDescriptor): MethodDecorator;
@@ -0,0 +1,8 @@
1
+ export declare enum StackedBarChartMilestone {
2
+ BLUE = "blue200",
3
+ GRAY = "gray600",
4
+ GREEN = "green200",
5
+ ORANGE = "orange200",
6
+ PURPLE = "purple200",
7
+ RED = "red200"
8
+ }
@@ -0,0 +1,7 @@
1
+ export declare enum SteppedProgressBarColor {
2
+ PURPLE = "purple",
3
+ RED = "red",
4
+ BLUE = "blue",
5
+ ORANGE = "orange",
6
+ GRAY = "gray"
7
+ }
package/lib/table.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ export declare enum SortDirection {
2
+ ASCENDING = "ascending",
3
+ DESCENDING = "descending"
4
+ }
5
+ export interface SortedColumn {
6
+ key: string;
7
+ direction: SortDirection;
8
+ }
9
+ export declare type SortChangeHandler = (newSort: SortedColumn[]) => void;
10
+ export declare type ResizeState = Record<string, number>;
11
+ export declare type ResizeStateChangeHandler = (newResizeState: ResizeState) => void;
12
+ export declare type SpsTableCellWrapWidth = 200 | 300 | 400 | 500 | 600;
package/lib/tabs.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ import type { SpsIcon } from "./icon";
2
+ export interface SpsTab {
3
+ /** id of the tab itself. */
4
+ id?: string;
5
+ /**
6
+ * id of the pane associated with the tab, which is
7
+ * displayed when the tab is active.
8
+ */
9
+ controlsId?: string;
10
+ icon?: SpsIcon;
11
+ label: string;
12
+ tag?: string;
13
+ }
package/lib/tag.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ export declare enum TagKind {
2
+ DEFAULT = "default",
3
+ KEY = "key",
4
+ WARNING = "warning",
5
+ ERROR = "error",
6
+ PENDING = "pending",
7
+ SUCCESS = "success",
8
+ INFO = "info"
9
+ }
@@ -0,0 +1,24 @@
1
+ import { SpsIcon } from "./icon";
2
+ import type { SpsActionMethod } from "./sps-action";
3
+ /** The possible statuses for a task in the Task Queue. */
4
+ export declare enum SpsTaskStatus {
5
+ COMPLETED = "completed",
6
+ ERRORED = "errored",
7
+ WARNING = "warning",
8
+ IN_PROGRESS = "in_progress"
9
+ }
10
+ export declare const SpsTaskStatusIcons: Readonly<{
11
+ completed: SpsIcon;
12
+ errored: SpsIcon;
13
+ warning: SpsIcon;
14
+ in_progress: string;
15
+ }>;
16
+ /** Represents a task in the Task Queue. */
17
+ export interface SpsTask {
18
+ status: SpsTaskStatus;
19
+ unread: boolean;
20
+ heading: string;
21
+ subheading: any;
22
+ actions?: SpsActionMethod[];
23
+ }
24
+ export declare const TASK_QUEUE_NOTIFICATION_DURATION_MS = 5000;
@@ -0,0 +1,13 @@
1
+ export declare const TOOLTIP_HIDE_DELAY_MS_DEFAULT = 1000;
2
+ export declare enum TooltipShowTrigger {
3
+ MANUAL = "manual",
4
+ MOUSEOVER = "mouseover",
5
+ CLICK = "click"
6
+ }
7
+ export declare enum TooltipKind {
8
+ DEFAULT = "default",
9
+ HELP = "help",
10
+ ERROR = "error",
11
+ WARNING = "warning",
12
+ CONTAINER = "container"
13
+ }
@@ -0,0 +1,139 @@
1
+ declare const _default: {
2
+ advancedSearch: {
3
+ clear: string;
4
+ search: string;
5
+ };
6
+ button: {
7
+ spinningTitle: string;
8
+ };
9
+ columnChooser: {
10
+ removeButton: string;
11
+ };
12
+ contentRow: {
13
+ collapse: string;
14
+ expand: string;
15
+ };
16
+ datepicker: {
17
+ calendar: {
18
+ prevMonth: string;
19
+ nextMonth: string;
20
+ };
21
+ preset: {
22
+ custom: string;
23
+ today: string;
24
+ sevenDays: string;
25
+ thirtyDays: string;
26
+ sixtyDays: string;
27
+ ninetyDays: string;
28
+ oneYear: string;
29
+ };
30
+ presetsLabel: string;
31
+ };
32
+ fileUpload: {
33
+ acceptedTypes: string;
34
+ acceptedTypes_plural: string;
35
+ cancelled: string;
36
+ cancelled_plural: string;
37
+ close: string;
38
+ instructions: string;
39
+ instructions_plural: string;
40
+ maximumSize: string;
41
+ processing: string;
42
+ title: string;
43
+ };
44
+ filterPanel: {
45
+ clear: string;
46
+ title: string;
47
+ filterPlaceholder: string;
48
+ };
49
+ focusedTask: {
50
+ close: string;
51
+ };
52
+ growler: {
53
+ dismiss: string;
54
+ };
55
+ insightCard: {
56
+ all: string;
57
+ partnerCount: string;
58
+ partners: string;
59
+ };
60
+ insightTile: {
61
+ all: string;
62
+ partnerCount: string;
63
+ partners: string;
64
+ };
65
+ label: {
66
+ errors: {
67
+ dateConstraint: {
68
+ max: string;
69
+ min: string;
70
+ };
71
+ dateFormat: string;
72
+ dateRangeOrder: string;
73
+ dateValidity: string;
74
+ max: string;
75
+ maxLength: string;
76
+ min: string;
77
+ minLength: string;
78
+ required: string;
79
+ };
80
+ preventativeErrors: {
81
+ maxLength: string;
82
+ alpha: string;
83
+ numeric: string;
84
+ nonNumeric: string;
85
+ };
86
+ stronglySuggested: string;
87
+ };
88
+ listActionBar: {
89
+ clearSelected: string;
90
+ itemsSelected: string;
91
+ };
92
+ listToolbar: {
93
+ advancedSearchToggle: string;
94
+ };
95
+ modal: {
96
+ close: string;
97
+ defaultButtonLabel: string;
98
+ defaultTitle: {
99
+ general: string;
100
+ info: string;
101
+ success: string;
102
+ warning: string;
103
+ "serious-warning": string;
104
+ };
105
+ };
106
+ pagination: {
107
+ nextPage: string;
108
+ ofMany: string;
109
+ ofPageCount: string;
110
+ page: string;
111
+ prevPage: string;
112
+ };
113
+ progressBar: {
114
+ closeButtonTitle: string;
115
+ };
116
+ searchResultsBar: {
117
+ clear: string;
118
+ clearResults: string;
119
+ count: string;
120
+ matchingResults: string;
121
+ noAdvancedSearchSelections: string;
122
+ results: string;
123
+ };
124
+ select: {
125
+ defaultPlaceholder: string;
126
+ };
127
+ slackLink: {
128
+ label: string;
129
+ };
130
+ spinner: {
131
+ defaultAltText: string;
132
+ };
133
+ taskQueue: {
134
+ clearCompleted: string;
135
+ newTask: string;
136
+ noTasks: string;
137
+ };
138
+ };
139
+ export default _default;
@@ -0,0 +1,6 @@
1
+ export declare enum WizardSubstepConditions {
2
+ BASIC = "basic",
3
+ COMPLETED = "completed",
4
+ COMPLETE = "completed",
5
+ ACTIVE = "active"
6
+ }
@@ -0,0 +1,7 @@
1
+ export declare enum ZStratum {
2
+ BASE = 0,
3
+ TIP = 10,
4
+ DROPDOWN = 100,
5
+ BAR = 1000,
6
+ DIALOG = 10000
7
+ }
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@spscommerce/ds-shared",
3
+ "description": "Package for sharing code and types between DS Angular and DS React.",
4
+ "version": "0.1.0",
5
+ "author": "SPS Commerce",
6
+ "license": "UNLICENSED",
7
+ "repository": "https://github.com/spscommerce/design-system/tree/main/packages/@spscommerce/ds-shared",
8
+ "homepage": "https://github.com/spscommerce/design-system/tree/main/packages/@spscommerce/ds-shared#readme",
9
+ "publishConfig": {
10
+ "access": "public"
11
+ },
12
+ "main": "./lib/index.cjs.js",
13
+ "module": "./lib/index.es.js",
14
+ "types": "./lib/index.d.ts",
15
+ "peerDependencies": {
16
+ "@spscommerce/utils": "0.1.0",
17
+ "moment": "^2.25.3",
18
+ "moment-timezone": "^0.5.28"
19
+ },
20
+ "devDependencies": {
21
+ "@spscommerce/utils": "0.1.0",
22
+ "moment": "^2.25.3",
23
+ "moment-timezone": "^0.5.28"
24
+ },
25
+ "scripts": {
26
+ "build": "pnpm run build:copy-translations && pnpm run build:js && pnpm run build:types",
27
+ "build:js": "vite build",
28
+ "build:types": "tsc --emitDeclarationOnly --declaration --declarationDir lib",
29
+ "watch": "vite build --watch",
30
+ "clean": "git clean -fdX",
31
+ "pub": "pnpm pack && node ../../scripts/publish-package.js",
32
+ "build:copy-translations": "echo \"export default \"$(cat ../i18n/locales/en-US/design-system.json)\";\" > src/translations.ts"
33
+ },
34
+ "readme": "[//]: # \"START_AUTOGENERATED\"\n\n## [@spscommerce/ds-shared](https://github.com/spscommerce/design-system/tree/main/packages/@spscommerce/ds-shared#readme)\n\n![release: 1.1.0](https://img.shields.io/badge/release-1.1.0-blue.svg?style=flat-square)\n![build: passing](https://img.shields.io/badge/build-passing-green.svg?style=flat-square)\n![tests: failing](https://img.shields.io/badge/tests-failing-red.svg?style=flat-square)\n\nPackage for sharing code and types between DS Angular and DS React. \n \n ### Installation \n \n ```shell\nnpm install --save @spscommerce/ds-shared\n```\n\n#### Peer Dependencies\n\n<div class=\"row\">\n <div class=\"col-5\"> \n <table class=\"sps-table\">\n <thead class=\"sps-table__head\">\n <tr class=\"sps-table__row\">\n <th class=\"sps-table__header\">\n <span class=\"sps-table__header-cell-body\"> \n Package\n </span>\n </th>\n <th class=\"sps-table__header text-right\">\n <span class=\"sps-table__header-cell-body\"> \n Version\n </span>\n </th>\n </tr>\n </thead>\n <tbody class=\"sps-table__body\">\n <tr class=\"sps-table__row\"><td class=\"sps-table__cell\"><a href=\"https://github.com/spscommerce/design-system/tree/main/packages/@spscommerce/utils#readme\">@spscommerce/utils</a></td><td class=\"sps-table__cell text-right\">^1.1.0</td></tr>\n<tr class=\"sps-table__row\"><td class=\"sps-table__cell\"><a href=\"https://momentjs.com\">moment</a></td><td class=\"sps-table__cell text-right\">^2.25.3</td></tr>\n<tr class=\"sps-table__row\"><td class=\"sps-table__cell\"><a href=\"http://momentjs.com/timezone/\">moment-timezone</a></td><td class=\"sps-table__cell text-right\">^0.5.28</td></tr>\n </tbody>\n </table>\n </div>\n <div class=\"col-7\">\n &nbsp;\n </div>\n</div>\n\n[//]: # \"END_AUTOGENERATED\"\n"
35
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "baseUrl": "tsconfig",
5
+ "rootDir": "src/",
6
+ "outDir": "./dist/out-tsc",
7
+ "target": "es5",
8
+ "esModuleInterop": true,
9
+ "declaration": true
10
+ },
11
+ "include": ["src/**/*"],
12
+ "exclude": ["node_modules", "lib"]
13
+ }
package/vite.config.js ADDED
@@ -0,0 +1,20 @@
1
+ import path from 'path';
2
+
3
+ import { defineConfig } from 'vite';
4
+
5
+ import pkg from './package.json';
6
+
7
+ export default defineConfig({
8
+ build: {
9
+ lib: {
10
+ entry: path.resolve(__dirname, 'src/index.ts'),
11
+ formats: ['es', 'cjs'],
12
+ fileName: (format) => `index.${format}.js`,
13
+ },
14
+ outDir: path.resolve(__dirname, './lib'),
15
+ emptyOutDir: false,
16
+ rollupOptions: {
17
+ external: pkg.peerDependencies ? Object.keys(pkg.peerDependencies) : [],
18
+ },
19
+ },
20
+ });