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

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 (45) 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/toast/gator/base/toast.gator.scss.js +1 -1
  29. package/dist/packages/web-components/src/components/toast-container/gator/toast-container.gator.scss.js +1 -0
  30. package/dist/packages/web-components/src/components/toaster/gator/toaster.gator.scss.js +1 -0
  31. package/dist/services/toaster-service.js +1 -0
  32. package/dist/types/components/toast/toast.d.ts +14 -0
  33. package/dist/types/components/toast-container/gator/toast-container.gator.d.ts +15 -0
  34. package/dist/types/components/toast-container/gator/toast-container.gator.test.d.ts +0 -0
  35. package/dist/types/components/toast-container/index.d.ts +1 -0
  36. package/dist/types/components/toaster/gator/toaster.gator.d.ts +32 -0
  37. package/dist/types/components/toaster/gator/toaster.gator.test.d.ts +0 -0
  38. package/dist/types/components/toaster/index.d.ts +1 -0
  39. package/dist/types/index.d.ts +2 -0
  40. package/dist/types/index.gator.d.ts +2 -0
  41. package/dist/types/index.services.d.ts +1 -0
  42. package/dist/types/services/toaster-service.d.ts +117 -0
  43. package/dist/types/services/toaster-service.test.d.ts +1 -0
  44. package/package.json +6 -2
  45. package/web-types.json +181 -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.4",
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.3",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -5008,10 +5008,74 @@
5008
5008
  }
5009
5009
  },
5010
5010
  {
5011
- "name": "ngc-toast",
5012
- "description": "\n---\n\n\n### **Events:**\n - **dismiss**\n\n### **Slots:**\n - _default_ - The content within the toast",
5011
+ "name": "ngc-toast-title",
5012
+ "description": "\n---\n\n\n### **Slots:**\n - _default_ - The title content",
5013
+ "doc-url": "",
5014
+ "attributes": [
5015
+ {
5016
+ "name": "id",
5017
+ "description": "Unique identifier for the toast.",
5018
+ "value": { "type": "string", "default": "''" }
5019
+ },
5020
+ {
5021
+ "name": "variant",
5022
+ "value": {
5023
+ "type": "'info' | 'warning' | 'error' | 'success' | 'inverse' | 'AI'",
5024
+ "default": "'info'"
5025
+ }
5026
+ },
5027
+ {
5028
+ "name": "dismissible",
5029
+ "value": { "type": "boolean", "default": "false" }
5030
+ },
5031
+ {
5032
+ "name": "sticky",
5033
+ "value": { "type": "boolean", "default": "false" }
5034
+ },
5035
+ { "name": "exit-icon-label", "value": { "type": "string" } },
5036
+ {
5037
+ "name": "status-icon-label",
5038
+ "value": { "type": "string", "default": "''" }
5039
+ },
5040
+ { "name": "title", "value": { "type": "string", "default": "''" } },
5041
+ {
5042
+ "name": "subtitle",
5043
+ "value": { "type": "string", "default": "''" }
5044
+ }
5045
+ ],
5046
+ "slots": [{ "name": "", "description": "The title content" }],
5047
+ "events": [],
5048
+ "js": {
5049
+ "properties": [
5050
+ {
5051
+ "name": "id",
5052
+ "description": "Unique identifier for the toast.",
5053
+ "type": "string"
5054
+ },
5055
+ {
5056
+ "name": "variant",
5057
+ "type": "'info' | 'warning' | 'error' | 'success' | 'inverse' | 'AI'"
5058
+ },
5059
+ { "name": "dismissible", "type": "boolean" },
5060
+ { "name": "sticky", "type": "boolean" },
5061
+ { "name": "exitIconLabel", "type": "string" },
5062
+ { "name": "statusIconLabel", "type": "string" },
5063
+ { "name": "title", "type": "string" },
5064
+ { "name": "subtitle", "type": "string" }
5065
+ ],
5066
+ "events": []
5067
+ }
5068
+ },
5069
+ {
5070
+ "name": "ngc-toast-subtitle",
5071
+ "description": "\n---\n\n\n### **Slots:**\n - _default_ - The subtitle content",
5013
5072
  "doc-url": "",
5014
5073
  "attributes": [
5074
+ {
5075
+ "name": "id",
5076
+ "description": "Unique identifier for the toast.",
5077
+ "value": { "type": "string", "default": "''" }
5078
+ },
5015
5079
  {
5016
5080
  "name": "variant",
5017
5081
  "value": {
@@ -5027,10 +5091,66 @@
5027
5091
  "name": "sticky",
5028
5092
  "value": { "type": "boolean", "default": "false" }
5029
5093
  },
5094
+ { "name": "exit-icon-label", "value": { "type": "string" } },
5095
+ {
5096
+ "name": "status-icon-label",
5097
+ "value": { "type": "string", "default": "''" }
5098
+ },
5099
+ { "name": "title", "value": { "type": "string", "default": "''" } },
5100
+ {
5101
+ "name": "subtitle",
5102
+ "value": { "type": "string", "default": "''" }
5103
+ }
5104
+ ],
5105
+ "slots": [{ "name": "", "description": "The subtitle content" }],
5106
+ "events": [],
5107
+ "js": {
5108
+ "properties": [
5109
+ {
5110
+ "name": "id",
5111
+ "description": "Unique identifier for the toast.",
5112
+ "type": "string"
5113
+ },
5114
+ {
5115
+ "name": "variant",
5116
+ "type": "'info' | 'warning' | 'error' | 'success' | 'inverse' | 'AI'"
5117
+ },
5118
+ { "name": "dismissible", "type": "boolean" },
5119
+ { "name": "sticky", "type": "boolean" },
5120
+ { "name": "exitIconLabel", "type": "string" },
5121
+ { "name": "statusIconLabel", "type": "string" },
5122
+ { "name": "title", "type": "string" },
5123
+ { "name": "subtitle", "type": "string" }
5124
+ ],
5125
+ "events": []
5126
+ }
5127
+ },
5128
+ {
5129
+ "name": "ngc-toast",
5130
+ "description": "\n---\n\n\n### **Events:**\n - **dismiss**\n\n### **Slots:**\n - _default_ - The content within the toast",
5131
+ "doc-url": "",
5132
+ "attributes": [
5030
5133
  {
5031
- "name": "exit-icon-label",
5134
+ "name": "id",
5135
+ "description": "Unique identifier for the toast.",
5032
5136
  "value": { "type": "string", "default": "''" }
5033
5137
  },
5138
+ {
5139
+ "name": "variant",
5140
+ "value": {
5141
+ "type": "'info' | 'warning' | 'error' | 'success' | 'inverse' | 'AI'",
5142
+ "default": "'info'"
5143
+ }
5144
+ },
5145
+ {
5146
+ "name": "dismissible",
5147
+ "value": { "type": "boolean", "default": "false" }
5148
+ },
5149
+ {
5150
+ "name": "sticky",
5151
+ "value": { "type": "boolean", "default": "false" }
5152
+ },
5153
+ { "name": "exit-icon-label", "value": { "type": "string" } },
5034
5154
  {
5035
5155
  "name": "status-icon-label",
5036
5156
  "value": { "type": "string", "default": "''" }
@@ -5052,6 +5172,11 @@
5052
5172
  { "name": "variantClass" },
5053
5173
  { "name": "iconMarkup" },
5054
5174
  { "name": "dismissibleMarkup" },
5175
+ {
5176
+ "name": "id",
5177
+ "description": "Unique identifier for the toast.",
5178
+ "type": "string"
5179
+ },
5055
5180
  {
5056
5181
  "name": "variant",
5057
5182
  "type": "'info' | 'warning' | 'error' | 'success' | 'inverse' | 'AI'"
@@ -5066,6 +5191,58 @@
5066
5191
  "events": [{ "name": "dismiss", "type": "CustomEvent" }]
5067
5192
  }
5068
5193
  },
5194
+ {
5195
+ "name": "ngc-toast-container",
5196
+ "description": "\n---\n",
5197
+ "doc-url": "",
5198
+ "attributes": [
5199
+ {
5200
+ "name": "toasts",
5201
+ "value": { "type": "NJC_TOAST_OPTIONS[]", "default": "[]" }
5202
+ }
5203
+ ],
5204
+ "events": [],
5205
+ "js": {
5206
+ "properties": [{ "name": "toasts", "type": "NJC_TOAST_OPTIONS[]" }],
5207
+ "events": []
5208
+ }
5209
+ },
5210
+ {
5211
+ "name": "ngc-toaster",
5212
+ "description": "\n---\n",
5213
+ "doc-url": "",
5214
+ "attributes": [
5215
+ {
5216
+ "name": "position",
5217
+ "description": "Fixed position of the toast container on the screen",
5218
+ "value": {
5219
+ "type": "'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right'",
5220
+ "default": "'top-right'"
5221
+ }
5222
+ },
5223
+ {
5224
+ "name": "default-toast-options",
5225
+ "description": "Default options for toasts created by this toaster. Can be overridden by the `addToast` method.",
5226
+ "value": { "type": "DefaultToastOptions", "default": "{}" }
5227
+ }
5228
+ ],
5229
+ "events": [],
5230
+ "js": {
5231
+ "properties": [
5232
+ {
5233
+ "name": "position",
5234
+ "description": "Fixed position of the toast container on the screen",
5235
+ "type": "'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right'"
5236
+ },
5237
+ {
5238
+ "name": "defaultToastOptions",
5239
+ "description": "Default options for toasts created by this toaster. Can be overridden by the `addToast` method.",
5240
+ "type": "DefaultToastOptions"
5241
+ }
5242
+ ],
5243
+ "events": []
5244
+ }
5245
+ },
5069
5246
  {
5070
5247
  "name": "nsc-tooltip",
5071
5248
  "description": "\n---\n\n\n### **Methods:**\n - **assignPosition()** - Override this function to use floating UI autoUpdate and computePosition",
@@ -5688,110 +5865,6 @@
5688
5865
  ],
5689
5866
  "events": []
5690
5867
  }
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
5868
  }
5796
5869
  ]
5797
5870
  },