@ncino/web-components 5.0.0-preview.3 → 5.0.0-preview.5

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.
Files changed (47) hide show
  1. package/dist/components/accordion/gator/group/accordion-group.gator.js +2 -2
  2. package/dist/components/alert/gator/base/alert.gator.js +2 -2
  3. package/dist/components/alert/gator/subtitle/alert-subtitle.gator.js +2 -2
  4. package/dist/components/alert/gator/title/alert-title.gator.js +2 -2
  5. package/dist/components/banner/gator/banner.gator.js +2 -2
  6. package/dist/components/card/gator/footer/card-footer.gator.js +2 -2
  7. package/dist/components/card/gator/header/card-header.gator.js +2 -2
  8. package/dist/components/checkbox/checkbox.gator.js +2 -2
  9. package/dist/components/modal/gator/modal.gator.js +2 -2
  10. package/dist/components/popover/gator/popover.gator.js +2 -2
  11. package/dist/components/radio/radio.gator.js +1 -1
  12. package/dist/components/selection-box-group/selection-box-group.gator.js +1 -1
  13. package/dist/components/toast/gator/base/toast.gator.js +8 -9
  14. package/dist/components/toast/gator/subtitle/toast-subtitle.gator.js +2 -2
  15. package/dist/components/toast/gator/title/toast-title.gator.js +2 -2
  16. package/dist/components/toast/toast.js +1 -1
  17. package/dist/components/toast-container/gator/toast-container.gator.js +18 -0
  18. package/dist/components/toast-container/index.js +1 -0
  19. package/dist/components/toaster/gator/toaster.gator.js +5 -0
  20. package/dist/components/toaster/index.js +1 -0
  21. package/dist/index.gator.js +1 -1
  22. package/dist/index.js +1 -1
  23. package/dist/index.services.js +1 -0
  24. package/dist/node_modules/.pnpm/lit-element@4.2.0/node_modules/lit-element/lit-element.js +2 -2
  25. package/dist/node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/directive-helpers.js +2 -2
  26. package/dist/node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/directives/repeat.js +5 -0
  27. package/dist/node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/lit-html.js +3 -3
  28. package/dist/packages/web-components/src/components/accordion/gator/group/accordion-group.gator.scss.js +1 -1
  29. package/dist/packages/web-components/src/components/toast/gator/base/toast.gator.scss.js +1 -1
  30. package/dist/packages/web-components/src/components/toast-container/gator/toast-container.gator.scss.js +1 -0
  31. package/dist/packages/web-components/src/components/toaster/gator/toaster.gator.scss.js +1 -0
  32. package/dist/services/toaster-service.js +1 -0
  33. package/dist/types/components/accordion/gator/group/accordion-group.gator.d.ts +5 -0
  34. package/dist/types/components/toast/toast.d.ts +14 -0
  35. package/dist/types/components/toast-container/gator/toast-container.gator.d.ts +15 -0
  36. package/dist/types/components/toast-container/gator/toast-container.gator.test.d.ts +0 -0
  37. package/dist/types/components/toast-container/index.d.ts +1 -0
  38. package/dist/types/components/toaster/gator/toaster.gator.d.ts +32 -0
  39. package/dist/types/components/toaster/gator/toaster.gator.test.d.ts +0 -0
  40. package/dist/types/components/toaster/index.d.ts +1 -0
  41. package/dist/types/index.d.ts +2 -0
  42. package/dist/types/index.gator.d.ts +2 -0
  43. package/dist/types/index.services.d.ts +1 -0
  44. package/dist/types/services/toaster-service.d.ts +117 -0
  45. package/dist/types/services/toaster-service.test.d.ts +1 -0
  46. package/package.json +6 -2
  47. package/web-types.json +186 -108
@@ -0,0 +1,117 @@
1
+ import { DefaultToastOptions } from '../components/toaster/gator/toaster.gator.js';
2
+ export type ToastCreateOptions = Partial<DefaultToastOptions> & {
3
+ title?: string;
4
+ subtitle?: string;
5
+ };
6
+ declare class ToasterService {
7
+ /**
8
+ * Find the toaster component in the DOM
9
+ * @private
10
+ * @returns The first visible toaster component or null if none found
11
+ */
12
+ private findToaster;
13
+ /**
14
+ * Create a toast using the toaster found in the DOM
15
+ * @param options - Configuration options for the toast
16
+ * @param options.title - The main title text for the toast
17
+ * @param options.subtitle - Optional subtitle text for the toast
18
+ * @param options.variant - The visual variant of the toast ('info' | 'success' | 'warning' | 'error' | 'inverse')
19
+ * @param options.duration - Duration in milliseconds before auto-dismiss (0 = sticky, >0 = auto-dismiss)
20
+ * @param options.dismissible - Whether the toast can be manually dismissed by the user
21
+ * @param options.exitIconLabel - Aria label for the dismiss button, default is 'Close Notification'
22
+ * @param options.statusIconLabel - Aria label for the status icon, default is the variant name (info, success, warning, error)
23
+ * @returns The unique ID of the created toast, or null if no toaster is found
24
+ * @example
25
+ * ```typescript
26
+ * // Simple usage
27
+ * const toastId = toasterService.createToast({
28
+ * title: 'Hello World',
29
+ * subtitle: 'This is a toast message'
30
+ * });
31
+ *
32
+ * // Advanced usage
33
+ * const toastId = toasterService.createToast({
34
+ * title: 'Custom Toast',
35
+ * variant: 'warning',
36
+ * duration: 10000,
37
+ * dismissible: false
38
+ * });
39
+ * ```
40
+ */
41
+ createToast(options: ToastCreateOptions): string | null;
42
+ /**
43
+ * Create a success toast with green styling
44
+ * @param title - The main title text for the toast
45
+ * @param subtitle - Optional subtitle text for the toast
46
+ * @param options - Additional configuration options (variant will be overridden to 'success')
47
+ * @returns The unique ID of the created toast, or null if no toaster is found
48
+ * @example
49
+ * ```typescript
50
+ * toasterService.success('Operation Complete', 'The file was saved successfully');
51
+ *
52
+ * // With custom options
53
+ * toasterService.success('Saved!', 'File saved', { duration: 2000 });
54
+ * ```
55
+ */
56
+ success(title: string, subtitle?: string, options?: Omit<ToastCreateOptions, 'title' | 'subtitle' | 'variant'>): string | null;
57
+ /**
58
+ * Create an error toast with red styling
59
+ * @param title - The main title text for the toast
60
+ * @param subtitle - Optional subtitle text for the toast
61
+ * @param options - Additional configuration options (variant will be overridden to 'error')
62
+ * @returns The unique ID of the created toast, or null if no toaster is found
63
+ * @example
64
+ * ```typescript
65
+ * toasterService.error('Failed to Save', 'Please check your connection and try again');
66
+ *
67
+ * // Sticky error that doesn't auto-dismiss
68
+ * toasterService.error('Critical Error', 'System malfunction detected', { duration: 0 });
69
+ * ```
70
+ */
71
+ error(title: string, subtitle?: string, options?: Omit<ToastCreateOptions, 'title' | 'subtitle' | 'variant'>): string | null;
72
+ /**
73
+ * Create a warning toast with yellow/orange styling
74
+ * @param title - The main title text for the toast
75
+ * @param subtitle - Optional subtitle text for the toast
76
+ * @param options - Additional configuration options (variant will be overridden to 'warning')
77
+ * @returns The unique ID of the created toast, or null if no toaster is found
78
+ * @example
79
+ * ```typescript
80
+ * toasterService.warning('Unsaved Changes', 'You have unsaved changes that will be lost');
81
+ *
82
+ * // Non-dismissible warning
83
+ * toasterService.warning('Low Storage', 'Running low on space', { dismissible: false });
84
+ * ```
85
+ */
86
+ warning(title: string, subtitle?: string, options?: Omit<ToastCreateOptions, 'title' | 'subtitle' | 'variant'>): string | null;
87
+ /**
88
+ * Create an info toast with blue styling (default variant)
89
+ * @param title - The main title text for the toast
90
+ * @param subtitle - Optional subtitle text for the toast
91
+ * @param options - Additional configuration options (variant will be overridden to 'info')
92
+ * @returns The unique ID of the created toast, or null if no toaster is found
93
+ * @example
94
+ * ```typescript
95
+ * toasterService.info('New Feature Available', 'Check out the new dashboard widgets');
96
+ *
97
+ * // Long-lasting info toast
98
+ * toasterService.info('Tip', 'Use Ctrl+S to save', { duration: 15000 });
99
+ * ```
100
+ */
101
+ info(title: string, subtitle?: string, options?: Omit<ToastCreateOptions, 'title' | 'subtitle' | 'variant'>): string | null;
102
+ /**
103
+ * Remove a specific toast by its ID
104
+ * @param id - The unique ID of the toast to remove (returned from createToast methods)
105
+ * @example
106
+ * ```typescript
107
+ * const toastId = toasterService.success('Uploading...', 'Please wait');
108
+ * // Later, when upload completes:
109
+ * toasterService.removeToast(toastId);
110
+ * toasterService.success('Upload Complete', 'File uploaded successfully');
111
+ * ```
112
+ */
113
+ removeToast(id: string): void;
114
+ clearAll(): void;
115
+ }
116
+ export declare const toasterService: ToasterService;
117
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ncino/web-components",
3
3
  "author": "nCino",
4
- "version": "5.0.0-preview.3",
4
+ "version": "5.0.0-preview.5",
5
5
  "license": "(c) Copyright 2023 nCino, Inc., all rights reserved",
6
6
  "publishConfig": {
7
7
  "registry": "https://registry.npmjs.org/"
@@ -36,6 +36,10 @@
36
36
  "import": "./dist/index.data.js",
37
37
  "types": "./dist/types/index.data.d.ts"
38
38
  },
39
+ "./services": {
40
+ "import": "./dist/index.services.js",
41
+ "types": "./dist/types/index.services.d.ts"
42
+ },
39
43
  "./gator-global-styles.css": {
40
44
  "import": "./dist/styles/gator/gator-global-styles.css"
41
45
  }
@@ -103,7 +107,7 @@
103
107
  "@vitest/ui": "3.2.4",
104
108
  "axe-core": "^4.10.3",
105
109
  "cem-plugin-expanded-types": "^1.4.0",
106
- "chromatic": "^12.2.0",
110
+ "chromatic": "^13.1.2",
107
111
  "conventional-changelog-conventionalcommits": "^9.0.0",
108
112
  "custom-element-jet-brains-integration": "^1.7.0",
109
113
  "custom-elements-manifest": "^2.1.0",
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "name": "@ncino/web-components",
4
- "version": "5.0.0-preview.2",
4
+ "version": "5.0.0-preview.4",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -384,6 +384,10 @@
384
384
  "name": "headingLevel",
385
385
  "value": { "type": "string", "default": "''" }
386
386
  },
387
+ {
388
+ "name": "hide-border",
389
+ "value": { "type": "boolean", "default": "false" }
390
+ },
387
391
  {
388
392
  "name": "is-expanded",
389
393
  "value": { "type": "boolean", "default": "false" }
@@ -410,6 +414,7 @@
410
414
  "properties": [
411
415
  { "name": "multiple", "type": "boolean" },
412
416
  { "name": "headingLevel", "type": "string" },
417
+ { "name": "hideBorder", "type": "boolean" },
413
418
  { "name": "isExpanded", "type": "boolean" },
414
419
  { "name": "title", "type": "String" },
415
420
  { "name": "subtitle", "type": "String" },
@@ -5008,10 +5013,15 @@
5008
5013
  }
5009
5014
  },
5010
5015
  {
5011
- "name": "ngc-toast",
5012
- "description": "\n---\n\n\n### **Events:**\n - **dismiss**\n\n### **Slots:**\n - _default_ - The content within the toast",
5016
+ "name": "ngc-toast-title",
5017
+ "description": "\n---\n\n\n### **Slots:**\n - _default_ - The title content",
5013
5018
  "doc-url": "",
5014
5019
  "attributes": [
5020
+ {
5021
+ "name": "id",
5022
+ "description": "Unique identifier for the toast.",
5023
+ "value": { "type": "string", "default": "''" }
5024
+ },
5015
5025
  {
5016
5026
  "name": "variant",
5017
5027
  "value": {
@@ -5027,10 +5037,125 @@
5027
5037
  "name": "sticky",
5028
5038
  "value": { "type": "boolean", "default": "false" }
5029
5039
  },
5040
+ { "name": "exit-icon-label", "value": { "type": "string" } },
5041
+ {
5042
+ "name": "status-icon-label",
5043
+ "value": { "type": "string", "default": "''" }
5044
+ },
5045
+ { "name": "title", "value": { "type": "string", "default": "''" } },
5046
+ {
5047
+ "name": "subtitle",
5048
+ "value": { "type": "string", "default": "''" }
5049
+ }
5050
+ ],
5051
+ "slots": [{ "name": "", "description": "The title content" }],
5052
+ "events": [],
5053
+ "js": {
5054
+ "properties": [
5055
+ {
5056
+ "name": "id",
5057
+ "description": "Unique identifier for the toast.",
5058
+ "type": "string"
5059
+ },
5060
+ {
5061
+ "name": "variant",
5062
+ "type": "'info' | 'warning' | 'error' | 'success' | 'inverse' | 'AI'"
5063
+ },
5064
+ { "name": "dismissible", "type": "boolean" },
5065
+ { "name": "sticky", "type": "boolean" },
5066
+ { "name": "exitIconLabel", "type": "string" },
5067
+ { "name": "statusIconLabel", "type": "string" },
5068
+ { "name": "title", "type": "string" },
5069
+ { "name": "subtitle", "type": "string" }
5070
+ ],
5071
+ "events": []
5072
+ }
5073
+ },
5074
+ {
5075
+ "name": "ngc-toast-subtitle",
5076
+ "description": "\n---\n\n\n### **Slots:**\n - _default_ - The subtitle content",
5077
+ "doc-url": "",
5078
+ "attributes": [
5030
5079
  {
5031
- "name": "exit-icon-label",
5080
+ "name": "id",
5081
+ "description": "Unique identifier for the toast.",
5032
5082
  "value": { "type": "string", "default": "''" }
5033
5083
  },
5084
+ {
5085
+ "name": "variant",
5086
+ "value": {
5087
+ "type": "'info' | 'warning' | 'error' | 'success' | 'inverse' | 'AI'",
5088
+ "default": "'info'"
5089
+ }
5090
+ },
5091
+ {
5092
+ "name": "dismissible",
5093
+ "value": { "type": "boolean", "default": "false" }
5094
+ },
5095
+ {
5096
+ "name": "sticky",
5097
+ "value": { "type": "boolean", "default": "false" }
5098
+ },
5099
+ { "name": "exit-icon-label", "value": { "type": "string" } },
5100
+ {
5101
+ "name": "status-icon-label",
5102
+ "value": { "type": "string", "default": "''" }
5103
+ },
5104
+ { "name": "title", "value": { "type": "string", "default": "''" } },
5105
+ {
5106
+ "name": "subtitle",
5107
+ "value": { "type": "string", "default": "''" }
5108
+ }
5109
+ ],
5110
+ "slots": [{ "name": "", "description": "The subtitle content" }],
5111
+ "events": [],
5112
+ "js": {
5113
+ "properties": [
5114
+ {
5115
+ "name": "id",
5116
+ "description": "Unique identifier for the toast.",
5117
+ "type": "string"
5118
+ },
5119
+ {
5120
+ "name": "variant",
5121
+ "type": "'info' | 'warning' | 'error' | 'success' | 'inverse' | 'AI'"
5122
+ },
5123
+ { "name": "dismissible", "type": "boolean" },
5124
+ { "name": "sticky", "type": "boolean" },
5125
+ { "name": "exitIconLabel", "type": "string" },
5126
+ { "name": "statusIconLabel", "type": "string" },
5127
+ { "name": "title", "type": "string" },
5128
+ { "name": "subtitle", "type": "string" }
5129
+ ],
5130
+ "events": []
5131
+ }
5132
+ },
5133
+ {
5134
+ "name": "ngc-toast",
5135
+ "description": "\n---\n\n\n### **Events:**\n - **dismiss**\n\n### **Slots:**\n - _default_ - The content within the toast",
5136
+ "doc-url": "",
5137
+ "attributes": [
5138
+ {
5139
+ "name": "id",
5140
+ "description": "Unique identifier for the toast.",
5141
+ "value": { "type": "string", "default": "''" }
5142
+ },
5143
+ {
5144
+ "name": "variant",
5145
+ "value": {
5146
+ "type": "'info' | 'warning' | 'error' | 'success' | 'inverse' | 'AI'",
5147
+ "default": "'info'"
5148
+ }
5149
+ },
5150
+ {
5151
+ "name": "dismissible",
5152
+ "value": { "type": "boolean", "default": "false" }
5153
+ },
5154
+ {
5155
+ "name": "sticky",
5156
+ "value": { "type": "boolean", "default": "false" }
5157
+ },
5158
+ { "name": "exit-icon-label", "value": { "type": "string" } },
5034
5159
  {
5035
5160
  "name": "status-icon-label",
5036
5161
  "value": { "type": "string", "default": "''" }
@@ -5052,6 +5177,11 @@
5052
5177
  { "name": "variantClass" },
5053
5178
  { "name": "iconMarkup" },
5054
5179
  { "name": "dismissibleMarkup" },
5180
+ {
5181
+ "name": "id",
5182
+ "description": "Unique identifier for the toast.",
5183
+ "type": "string"
5184
+ },
5055
5185
  {
5056
5186
  "name": "variant",
5057
5187
  "type": "'info' | 'warning' | 'error' | 'success' | 'inverse' | 'AI'"
@@ -5066,6 +5196,58 @@
5066
5196
  "events": [{ "name": "dismiss", "type": "CustomEvent" }]
5067
5197
  }
5068
5198
  },
5199
+ {
5200
+ "name": "ngc-toast-container",
5201
+ "description": "\n---\n",
5202
+ "doc-url": "",
5203
+ "attributes": [
5204
+ {
5205
+ "name": "toasts",
5206
+ "value": { "type": "NJC_TOAST_OPTIONS[]", "default": "[]" }
5207
+ }
5208
+ ],
5209
+ "events": [],
5210
+ "js": {
5211
+ "properties": [{ "name": "toasts", "type": "NJC_TOAST_OPTIONS[]" }],
5212
+ "events": []
5213
+ }
5214
+ },
5215
+ {
5216
+ "name": "ngc-toaster",
5217
+ "description": "\n---\n",
5218
+ "doc-url": "",
5219
+ "attributes": [
5220
+ {
5221
+ "name": "position",
5222
+ "description": "Fixed position of the toast container on the screen",
5223
+ "value": {
5224
+ "type": "'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right'",
5225
+ "default": "'top-right'"
5226
+ }
5227
+ },
5228
+ {
5229
+ "name": "default-toast-options",
5230
+ "description": "Default options for toasts created by this toaster. Can be overridden by the `addToast` method.",
5231
+ "value": { "type": "DefaultToastOptions", "default": "{}" }
5232
+ }
5233
+ ],
5234
+ "events": [],
5235
+ "js": {
5236
+ "properties": [
5237
+ {
5238
+ "name": "position",
5239
+ "description": "Fixed position of the toast container on the screen",
5240
+ "type": "'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right'"
5241
+ },
5242
+ {
5243
+ "name": "defaultToastOptions",
5244
+ "description": "Default options for toasts created by this toaster. Can be overridden by the `addToast` method.",
5245
+ "type": "DefaultToastOptions"
5246
+ }
5247
+ ],
5248
+ "events": []
5249
+ }
5250
+ },
5069
5251
  {
5070
5252
  "name": "nsc-tooltip",
5071
5253
  "description": "\n---\n\n\n### **Methods:**\n - **assignPosition()** - Override this function to use floating UI autoUpdate and computePosition",
@@ -5688,110 +5870,6 @@
5688
5870
  ],
5689
5871
  "events": []
5690
5872
  }
5691
- },
5692
- {
5693
- "name": "ngc-toast-subtitle",
5694
- "description": "\n---\n\n\n### **Slots:**\n - _default_ - The subtitle content",
5695
- "doc-url": "",
5696
- "attributes": [
5697
- {
5698
- "name": "variant",
5699
- "value": {
5700
- "type": "'info' | 'warning' | 'error' | 'success' | 'inverse' | 'AI'",
5701
- "default": "'info'"
5702
- }
5703
- },
5704
- {
5705
- "name": "dismissible",
5706
- "value": { "type": "boolean", "default": "false" }
5707
- },
5708
- {
5709
- "name": "sticky",
5710
- "value": { "type": "boolean", "default": "false" }
5711
- },
5712
- {
5713
- "name": "exit-icon-label",
5714
- "value": { "type": "string", "default": "''" }
5715
- },
5716
- {
5717
- "name": "status-icon-label",
5718
- "value": { "type": "string", "default": "''" }
5719
- },
5720
- { "name": "title", "value": { "type": "string", "default": "''" } },
5721
- {
5722
- "name": "subtitle",
5723
- "value": { "type": "string", "default": "''" }
5724
- }
5725
- ],
5726
- "slots": [{ "name": "", "description": "The subtitle content" }],
5727
- "events": [],
5728
- "js": {
5729
- "properties": [
5730
- {
5731
- "name": "variant",
5732
- "type": "'info' | 'warning' | 'error' | 'success' | 'inverse' | 'AI'"
5733
- },
5734
- { "name": "dismissible", "type": "boolean" },
5735
- { "name": "sticky", "type": "boolean" },
5736
- { "name": "exitIconLabel", "type": "string" },
5737
- { "name": "statusIconLabel", "type": "string" },
5738
- { "name": "title", "type": "string" },
5739
- { "name": "subtitle", "type": "string" }
5740
- ],
5741
- "events": []
5742
- }
5743
- },
5744
- {
5745
- "name": "ngc-toast-title",
5746
- "description": "\n---\n\n\n### **Slots:**\n - _default_ - The title content",
5747
- "doc-url": "",
5748
- "attributes": [
5749
- {
5750
- "name": "variant",
5751
- "value": {
5752
- "type": "'info' | 'warning' | 'error' | 'success' | 'inverse' | 'AI'",
5753
- "default": "'info'"
5754
- }
5755
- },
5756
- {
5757
- "name": "dismissible",
5758
- "value": { "type": "boolean", "default": "false" }
5759
- },
5760
- {
5761
- "name": "sticky",
5762
- "value": { "type": "boolean", "default": "false" }
5763
- },
5764
- {
5765
- "name": "exit-icon-label",
5766
- "value": { "type": "string", "default": "''" }
5767
- },
5768
- {
5769
- "name": "status-icon-label",
5770
- "value": { "type": "string", "default": "''" }
5771
- },
5772
- { "name": "title", "value": { "type": "string", "default": "''" } },
5773
- {
5774
- "name": "subtitle",
5775
- "value": { "type": "string", "default": "''" }
5776
- }
5777
- ],
5778
- "slots": [{ "name": "", "description": "The title content" }],
5779
- "events": [],
5780
- "js": {
5781
- "properties": [
5782
- {
5783
- "name": "variant",
5784
- "type": "'info' | 'warning' | 'error' | 'success' | 'inverse' | 'AI'"
5785
- },
5786
- { "name": "dismissible", "type": "boolean" },
5787
- { "name": "sticky", "type": "boolean" },
5788
- { "name": "exitIconLabel", "type": "string" },
5789
- { "name": "statusIconLabel", "type": "string" },
5790
- { "name": "title", "type": "string" },
5791
- { "name": "subtitle", "type": "string" }
5792
- ],
5793
- "events": []
5794
- }
5795
5873
  }
5796
5874
  ]
5797
5875
  },