fomantic-ui 2.9.4-beta.2 → 2.9.4-beta.20

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 (189) hide show
  1. package/.all-contributorsrc +11 -1
  2. package/.github/workflows/ci.yml +2 -2
  3. package/.github/workflows/nightly.yml +1 -1
  4. package/.github/workflows/release.yml +1 -1
  5. package/CONTRIBUTORS.md +1 -0
  6. package/dist/components/accordion.css +1 -1
  7. package/dist/components/accordion.js +1 -1
  8. package/dist/components/accordion.min.css +1 -1
  9. package/dist/components/accordion.min.js +1 -1
  10. package/dist/components/ad.css +1 -1
  11. package/dist/components/ad.min.css +1 -1
  12. package/dist/components/api.js +1 -1
  13. package/dist/components/api.min.js +1 -1
  14. package/dist/components/breadcrumb.css +1 -1
  15. package/dist/components/breadcrumb.min.css +1 -1
  16. package/dist/components/button.css +1 -1
  17. package/dist/components/button.min.css +1 -1
  18. package/dist/components/calendar.css +1 -1
  19. package/dist/components/calendar.js +1 -1
  20. package/dist/components/calendar.min.css +1 -1
  21. package/dist/components/calendar.min.js +1 -1
  22. package/dist/components/card.css +1 -1
  23. package/dist/components/card.min.css +1 -1
  24. package/dist/components/checkbox.css +1 -1
  25. package/dist/components/checkbox.js +1 -1
  26. package/dist/components/checkbox.min.css +1 -1
  27. package/dist/components/checkbox.min.js +1 -1
  28. package/dist/components/comment.css +1 -1
  29. package/dist/components/comment.min.css +1 -1
  30. package/dist/components/container.css +1 -1
  31. package/dist/components/container.min.css +1 -1
  32. package/dist/components/dimmer.css +1 -1
  33. package/dist/components/dimmer.js +1 -1
  34. package/dist/components/dimmer.min.css +1 -1
  35. package/dist/components/dimmer.min.js +1 -1
  36. package/dist/components/divider.css +1 -1
  37. package/dist/components/divider.min.css +1 -1
  38. package/dist/components/dropdown.css +15 -17
  39. package/dist/components/dropdown.js +2 -2
  40. package/dist/components/dropdown.min.css +2 -2
  41. package/dist/components/dropdown.min.js +2 -2
  42. package/dist/components/embed.css +1 -1
  43. package/dist/components/embed.js +1 -1
  44. package/dist/components/embed.min.css +1 -1
  45. package/dist/components/embed.min.js +1 -1
  46. package/dist/components/emoji.css +1 -1
  47. package/dist/components/emoji.min.css +1 -1
  48. package/dist/components/feed.css +1 -1
  49. package/dist/components/feed.min.css +1 -1
  50. package/dist/components/flag.css +1 -1
  51. package/dist/components/flag.min.css +1 -1
  52. package/dist/components/flyout.css +1 -1
  53. package/dist/components/flyout.js +1 -1
  54. package/dist/components/flyout.min.css +1 -1
  55. package/dist/components/flyout.min.js +1 -1
  56. package/dist/components/form.css +14 -5
  57. package/dist/components/form.js +44 -20
  58. package/dist/components/form.min.css +2 -2
  59. package/dist/components/form.min.js +2 -2
  60. package/dist/components/grid.css +5 -5
  61. package/dist/components/grid.min.css +2 -2
  62. package/dist/components/header.css +4 -1
  63. package/dist/components/header.min.css +2 -2
  64. package/dist/components/icon.css +1 -1
  65. package/dist/components/icon.min.css +1 -1
  66. package/dist/components/image.css +1 -1
  67. package/dist/components/image.min.css +1 -1
  68. package/dist/components/input.css +30 -10
  69. package/dist/components/input.min.css +2 -2
  70. package/dist/components/item.css +1 -1
  71. package/dist/components/item.min.css +1 -1
  72. package/dist/components/label.css +1 -2
  73. package/dist/components/label.min.css +2 -2
  74. package/dist/components/list.css +1 -1
  75. package/dist/components/list.min.css +1 -1
  76. package/dist/components/loader.css +1 -1
  77. package/dist/components/loader.min.css +1 -1
  78. package/dist/components/menu.css +1 -2
  79. package/dist/components/menu.min.css +2 -2
  80. package/dist/components/message.css +1 -1
  81. package/dist/components/message.min.css +1 -1
  82. package/dist/components/modal.css +1 -1
  83. package/dist/components/modal.js +1 -1
  84. package/dist/components/modal.min.css +1 -1
  85. package/dist/components/modal.min.js +1 -1
  86. package/dist/components/nag.css +1 -1
  87. package/dist/components/nag.js +1 -1
  88. package/dist/components/nag.min.css +1 -1
  89. package/dist/components/nag.min.js +1 -1
  90. package/dist/components/placeholder.css +1 -1
  91. package/dist/components/placeholder.min.css +1 -1
  92. package/dist/components/popup.css +1 -2
  93. package/dist/components/popup.js +1 -1
  94. package/dist/components/popup.min.css +2 -2
  95. package/dist/components/popup.min.js +1 -1
  96. package/dist/components/progress.css +1 -1
  97. package/dist/components/progress.js +1 -1
  98. package/dist/components/progress.min.css +1 -1
  99. package/dist/components/progress.min.js +1 -1
  100. package/dist/components/rail.css +1 -1
  101. package/dist/components/rail.min.css +1 -1
  102. package/dist/components/rating.css +1 -1
  103. package/dist/components/rating.js +1 -1
  104. package/dist/components/rating.min.css +1 -1
  105. package/dist/components/rating.min.js +1 -1
  106. package/dist/components/reset.css +1 -1
  107. package/dist/components/reset.min.css +1 -1
  108. package/dist/components/reveal.css +1 -1
  109. package/dist/components/reveal.min.css +1 -1
  110. package/dist/components/search.css +1 -1
  111. package/dist/components/search.js +1 -1
  112. package/dist/components/search.min.css +1 -1
  113. package/dist/components/search.min.js +1 -1
  114. package/dist/components/segment.css +1 -1
  115. package/dist/components/segment.min.css +1 -1
  116. package/dist/components/shape.css +1 -1
  117. package/dist/components/shape.js +1 -1
  118. package/dist/components/shape.min.css +1 -1
  119. package/dist/components/shape.min.js +1 -1
  120. package/dist/components/sidebar.css +1 -1
  121. package/dist/components/sidebar.js +1 -1
  122. package/dist/components/sidebar.min.css +1 -1
  123. package/dist/components/sidebar.min.js +1 -1
  124. package/dist/components/site.css +1 -1
  125. package/dist/components/site.js +1 -1
  126. package/dist/components/site.min.css +1 -1
  127. package/dist/components/site.min.js +1 -1
  128. package/dist/components/slider.css +1 -1
  129. package/dist/components/slider.js +1 -1
  130. package/dist/components/slider.min.css +1 -1
  131. package/dist/components/slider.min.js +1 -1
  132. package/dist/components/state.js +1 -1
  133. package/dist/components/state.min.js +1 -1
  134. package/dist/components/statistic.css +1 -1
  135. package/dist/components/statistic.min.css +1 -1
  136. package/dist/components/step.css +1 -1
  137. package/dist/components/step.min.css +1 -1
  138. package/dist/components/sticky.css +1 -1
  139. package/dist/components/sticky.js +1 -1
  140. package/dist/components/sticky.min.css +1 -1
  141. package/dist/components/sticky.min.js +1 -1
  142. package/dist/components/tab.css +1 -1
  143. package/dist/components/tab.js +1 -1
  144. package/dist/components/tab.min.css +1 -1
  145. package/dist/components/tab.min.js +1 -1
  146. package/dist/components/table.css +1 -1
  147. package/dist/components/table.min.css +1 -1
  148. package/dist/components/text.css +1 -1
  149. package/dist/components/text.min.css +1 -1
  150. package/dist/components/toast.css +1 -1
  151. package/dist/components/toast.js +1 -1
  152. package/dist/components/toast.min.css +1 -1
  153. package/dist/components/toast.min.js +1 -1
  154. package/dist/components/transition.css +1 -1
  155. package/dist/components/transition.js +1 -1
  156. package/dist/components/transition.min.css +1 -1
  157. package/dist/components/transition.min.js +1 -1
  158. package/dist/components/visibility.js +1 -1
  159. package/dist/components/visibility.min.js +1 -1
  160. package/dist/semantic.css +118 -89
  161. package/dist/semantic.js +70 -46
  162. package/dist/semantic.min.css +2 -2
  163. package/dist/semantic.min.js +2 -2
  164. package/package.json +1 -1
  165. package/src/definitions/behaviors/form.js +43 -19
  166. package/src/definitions/collections/form.less +13 -4
  167. package/src/definitions/collections/grid.less +4 -4
  168. package/src/definitions/elements/header.less +5 -0
  169. package/src/definitions/elements/input.less +14 -6
  170. package/src/definitions/modules/dropdown.js +1 -1
  171. package/src/definitions/modules/dropdown.less +2 -2
  172. package/src/themes/default/collections/form.variables +1 -0
  173. package/src/themes/default/globals/variation.variables +1 -0
  174. package/types/fomantic-ui-api.d.ts +8 -2
  175. package/types/fomantic-ui-calendar.d.ts +93 -8
  176. package/types/fomantic-ui-checkbox.d.ts +14 -4
  177. package/types/fomantic-ui-dropdown.d.ts +12 -17
  178. package/types/fomantic-ui-flyout.d.ts +21 -7
  179. package/types/fomantic-ui-form.d.ts +112 -17
  180. package/types/fomantic-ui-modal.d.ts +74 -4
  181. package/types/fomantic-ui-nag.d.ts +1 -1
  182. package/types/fomantic-ui-popup.d.ts +8 -8
  183. package/types/fomantic-ui-progress.d.ts +6 -0
  184. package/types/fomantic-ui-search.d.ts +30 -12
  185. package/types/fomantic-ui-tab.d.ts +1 -1
  186. package/types/fomantic-ui-tests.ts +162 -0
  187. package/types/fomantic-ui-toast.d.ts +6 -1
  188. package/types/fomantic-ui-transition.d.ts +28 -0
  189. package/types/fomantic-ui-visibility.d.ts +2 -2
@@ -10,7 +10,7 @@ declare namespace FomanticUI {
10
10
  /**
11
11
  * Displays message in search results with text, using template matching type.
12
12
  */
13
- (behavior: 'display message', text: string, type: string): JQuery;
13
+ (behavior: 'display message', text: string, type?: string): JQuery;
14
14
 
15
15
  /**
16
16
  * Cancels current remote search query.
@@ -124,7 +124,7 @@ declare namespace FomanticUI {
124
124
  * @see {@link https://fomantic-ui.com/behaviors/api.html#/settings}
125
125
  * @default {}
126
126
  */
127
- apiSettings: APISettings | JQueryAjaxSettings;
127
+ apiSettings: Partial<Pick<APISettings, keyof APISettings>> | JQueryAjaxSettings;
128
128
 
129
129
  /**
130
130
  * Minimum characters to query for results.
@@ -228,6 +228,24 @@ declare namespace FomanticUI {
228
228
  */
229
229
  ignoreDiacritics: boolean;
230
230
 
231
+ /**
232
+ * Template to use (specified in settings.templates)
233
+ * @default 'standard'
234
+ */
235
+ type: 'escape' | 'message' | 'category' | 'standard';
236
+
237
+ /**
238
+ * Field to display in standard results template
239
+ * @default ''
240
+ */
241
+ displayField: string;
242
+
243
+ /**
244
+ * Whether to add events to prompt automatically
245
+ * @default true
246
+ */
247
+ automatic: boolean;
248
+
231
249
  // endregion
232
250
 
233
251
  // region Callbacks
@@ -237,13 +255,13 @@ declare namespace FomanticUI {
237
255
  * The first parameter includes the filtered response results for that element.
238
256
  * The function should return 'false' to prevent default action (closing search results and selecting value).
239
257
  */
240
- onSelect(this: JQuery, result: object, response: object): boolean;
258
+ onSelect(this: JQuery, result: object, response: object): any;
241
259
 
242
260
  /**
243
261
  * Callback after processing element template to add HTML to results.
244
262
  * Function should return 'false' to prevent default actions.
245
263
  */
246
- onResultsAdd(this: JQuery, html: string): boolean;
264
+ onResultsAdd(this: JQuery, html: string): void | boolean;
247
265
 
248
266
  /**
249
267
  * Callback on search query.
@@ -352,24 +370,24 @@ declare namespace FomanticUI {
352
370
  namespace Settings {
353
371
  interface Templates {
354
372
  /**
355
- * @default function(string)
373
+ * @default function(string, preserveHTML)
356
374
  */
357
- escape: Function;
375
+ escape: (string: string, preserveHTML?: boolean) => string;
358
376
 
359
377
  /**
360
- * @default function(message, type)
378
+ * @default function(message, type, header)
361
379
  */
362
- message: Function;
380
+ message: (message: string, type?: string, header?: string) => string;
363
381
 
364
382
  /**
365
- * @default function(response)
383
+ * @default function(response, fields, preserveHTML)
366
384
  */
367
- category: Function;
385
+ category: (response: unknown, fields: {[key: string]: string}, preserveHTML?: boolean) => string;
368
386
 
369
387
  /**
370
- * @default function(response)
388
+ * @default function(response, fields, preserveHTML)
371
389
  */
372
- standard: Function;
390
+ standard: (response: unknown, fields: {[key: string]: string}, preserveHTML?: boolean) => string;
373
391
  }
374
392
 
375
393
  interface Selectors {
@@ -149,7 +149,7 @@ declare namespace FomanticUI {
149
149
  * Tabs are limited to those found inside this context.
150
150
  * @default false
151
151
  */
152
- context: false | string;
152
+ context: JQuery | string | false;
153
153
 
154
154
  /**
155
155
  * If enabled limits tabs to children of passed context.
@@ -23,3 +23,165 @@ $().tab(); // $ExpectType JQuery<HTMLElement>
23
23
  $('body').toast(); // $ExpectType JQuery<HTMLElement>
24
24
  $().transition(); // $ExpectType JQuery<HTMLElement>
25
25
  $().visibility(); // $ExpectType JQuery<HTMLElement>
26
+
27
+ /* Define API endpoints once globally */
28
+ $.fn.api.settings.api = {
29
+ 'get followers' : '/followers/{id}?results={count}',
30
+ 'create user' : '/create',
31
+ 'add user' : '/add/{id}',
32
+ 'follow user' : '/follow/{id}',
33
+ 'search' : '/search/?query={value}'
34
+ };
35
+
36
+ $().calendar({
37
+ today: true,
38
+ initialDate: null,
39
+ endCalendar: $()
40
+ }); // $ExpectType JQuery<HTMLElement>
41
+
42
+ $.flyout('alert','hello'); // $ExpectType JQuery<HTMLElement>
43
+ $.flyout('confirm','Are you sure?',function(){}); // $ExpectType JQuery<HTMLElement>
44
+ $.flyout('prompt','Enter Code', function(){}); // $ExpectType JQuery<HTMLElement>
45
+
46
+ $.fn.flyout.settings.templates.greet = function(username) {
47
+ return {
48
+ title: 'Greetings to ' + username + '!',
49
+ content: ''+ username.toUpperCase() + 'is the best!',
50
+ closeIcon: true,
51
+ class: 'inverted',
52
+ classContent: 'centered'
53
+ }
54
+ }
55
+
56
+ $().form({
57
+ fields: {
58
+ field1: {
59
+ rules: [
60
+ {
61
+ type : 'empty'
62
+ }
63
+ ]
64
+ },
65
+ field2: {
66
+ rules: [
67
+ {
68
+ type : 'isExactly[dog]',
69
+ prompt : '{name} is set to "{value}" that is totally wrong. It should be {ruleValue}'
70
+ }
71
+ ]
72
+ },
73
+ field3: {
74
+ rules: [
75
+ {
76
+ type : 'isExactly[cat]',
77
+ prompt : function(value) {
78
+ if(value == 'dog') {
79
+ return 'I told you to put cat, not dog!';
80
+ }
81
+ return 'That is not cat';
82
+ }
83
+ }
84
+ ]
85
+ },
86
+ color: {
87
+ identifier: 'color',
88
+ rules: [{
89
+ type: 'regExp',
90
+ value: /rgb\((\d{1,3}), (\d{1,3}), (\d{1,3})\)/i,
91
+ }]
92
+ },
93
+ yearsPracticed: {
94
+ identifier : 'yearsPracticed',
95
+ depends : 'isDoctor',
96
+ rules : [
97
+ {
98
+ type : 'empty',
99
+ prompt : 'Please enter the number of years you have been a doctor'
100
+ }
101
+ ]
102
+ },
103
+ ccEmail: {
104
+ identifier : 'cc-email',
105
+ optional : true,
106
+ rules: [
107
+ {
108
+ type : 'email',
109
+ prompt : 'Please enter a valid second e-mail'
110
+ }
111
+ ]
112
+ }
113
+ }
114
+ }); // $ExpectType JQuery<HTMLElement>
115
+
116
+ $().form({
117
+ fields: {
118
+ gender: 'empty',
119
+ name: 'empty',
120
+ password : ['minLength[6]', 'empty']
121
+ }
122
+ }); // $ExpectType JQuery<HTMLElement>
123
+
124
+ $.fn.form.settings.rules.date = function(str_date: string) {
125
+ return true;
126
+ };
127
+
128
+ $.modal('alert', {
129
+ title: 'Listen to me',
130
+ content: 'I love Fomantic-UI',
131
+ handler: function() {
132
+ $.toast({message:'Great!'});
133
+ }
134
+ });
135
+
136
+ $.fn.modal.settings.templates.greet = function(username: string) {
137
+ // do something according to modals settings and/or given parameters
138
+ return {
139
+ title: 'Greetings to ' + username + '!',
140
+ content: ''+ username.toUpperCase() + 'is the best!',
141
+ class: 'inverted',
142
+ classContent: 'centered',
143
+ dimmerSettings: {
144
+ variation: 'inverted'
145
+ }
146
+ }
147
+ }
148
+
149
+ $.modal('greet', 'mom');
150
+
151
+ $().nag({
152
+ persist: true
153
+ }); // $ExpectType JQuery<HTMLElement>
154
+
155
+ $().search("display message", "Hello, world !"); // $ExpectType JQuery<HTMLElement>
156
+
157
+ // To change the defaults for all toast at once override the module as follows
158
+ $.fn.toast.settings.progressUp = true;
159
+ $.fn.toast.settings.class = 'info';
160
+ $.fn.toast.settings.showIcon = true;
161
+ $.fn.toast.settings.className.box = 'toast-box'; //removes shadow
162
+ $.fn.toast.settings.className.title = 'header'; // smaller font size
163
+ $.fn.toast.settings.className.icon = 'icon'; // top position again
164
+ $.fn.toast.settings.transition.closeEasing = 'easeOutBounce';
165
+
166
+ // Or apply the old defaults directly to the toast
167
+ $.toast({
168
+ title: 'LOOK',
169
+ message: 'Turned back time to 2.7.0 defaults',
170
+ showProgress: 'bottom',
171
+ //make it look like 2.7.0
172
+ showIcon: true,
173
+ progressUp: true,
174
+ class: 'info',
175
+ className: {
176
+ box:'toast-box',
177
+ title:'header',
178
+ icon: 'icon'
179
+ },
180
+ transition: {
181
+ closeEasing: 'easeOutBounce'
182
+ }
183
+ });
184
+
185
+ $().transition("shake", "200ms");
186
+ $().transition("horizontal flip", 500, function() { alert('done!'); });
187
+ $().transition("fade up");
@@ -12,6 +12,11 @@ declare namespace FomanticUI {
12
12
  */
13
13
  (behavior: 'animate continue'): JQuery;
14
14
 
15
+ /**
16
+ * Show the toast
17
+ */
18
+ (behavior: 'show'): JQuery;
19
+
15
20
  /**
16
21
  * Closes the toast
17
22
  */
@@ -273,7 +278,7 @@ declare namespace FomanticUI {
273
278
  /**
274
279
  * An array of objects. Each object defines an action with 'properties' 'text', 'class', 'icon' and 'click'.
275
280
  */
276
- actions: Toast.ActionsSettings;
281
+ actions: Toast.ActionsSettings[];
277
282
 
278
283
  // endregion
279
284
 
@@ -112,6 +112,34 @@ declare namespace FomanticUI {
112
112
  */
113
113
  (behavior: 'is supported'): boolean;
114
114
 
115
+ (behavior: 'scale', duration?: any, onComplete?: () => any): JQuery;
116
+
117
+ (behavior: 'zoom', duration?: any, onComplete?: () => any): JQuery;
118
+
119
+ (behavior: 'fade' | 'fade up' | 'fade down' | 'fade left' | 'fade right', duration?: any, onComplete?: () => any): JQuery;
120
+
121
+ (behavior: 'horizontal flip' | 'vertical flip', duration?: any, onComplete?: () => any): JQuery;
122
+
123
+ (behavior: 'drop', duration?: any, onComplete?: () => any): JQuery;
124
+
125
+ (behavior: 'fly up' | 'fly down' | 'fly left' | 'fly right', duration?: any, onComplete?: () => any): JQuery;
126
+
127
+ (behavior: 'swing up' | 'swing down' | 'swing left' | 'swing right', duration?: any, onComplete?: () => any): JQuery;
128
+
129
+ (behavior: 'browse' | 'browse up' | 'browse down' | 'browse left' | 'browse right', duration?: any, onComplete?: () => any): JQuery;
130
+
131
+ (behavior: 'slide up' | 'slide down' | 'slide left' | 'slide right', duration?: any, onComplete?: () => any): JQuery;
132
+
133
+ // Static animations
134
+ (behavior: 'pulsating', duration?: any, onComplete?: () => any): JQuery;
135
+ (behavior: 'jiggle', duration?: any, onComplete?: () => any): JQuery;
136
+ (behavior: 'flash', duration?: any, onComplete?: () => any): JQuery;
137
+ (behavior: 'shake', duration?: any, onComplete?: () => any): JQuery;
138
+ (behavior: 'pulse', duration?: any, onComplete?: () => any): JQuery;
139
+ (behavior: 'tada', duration?: any, onComplete?: () => any): JQuery;
140
+ (behavior: 'bounce', duration?: any, onComplete?: () => any): JQuery;
141
+ (behavior: 'glow', duration?: any, onComplete?: () => any): JQuery;
142
+
115
143
  /**
116
144
  * Destroys instance and removes all events.
117
145
  */
@@ -46,8 +46,8 @@ declare namespace FomanticUI {
46
46
  (behavior: 'destroy'): JQuery;
47
47
  <K extends keyof VisibilitySettings>(behavior: 'setting', name: K, value?: undefined, ): Partial<Pick<VisibilitySettings, keyof VisibilitySettings>>;
48
48
  <K extends keyof VisibilitySettings>(behavior: 'setting', name: K, value: VisibilitySettings[K]): JQuery;
49
- (behavior: 'setting', value: VisibilitySettings): JQuery;
50
- (settings?: VisibilitySettings): JQuery;
49
+ (behavior: 'setting', value: Partial<Pick<VisibilitySettings, keyof VisibilitySettings>>): JQuery;
50
+ (settings?: Partial<Pick<VisibilitySettings, keyof VisibilitySettings>>): JQuery;
51
51
  }
52
52
 
53
53
  /**