5htp-core 0.6.0-7 → 0.6.0-72

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.
@@ -61,8 +61,8 @@ export default (initProps: Props) => {
61
61
  props.min = props.min ?? 0;
62
62
  } else if (props.type === 'longtext' && typeof document !== 'undefined') {
63
63
  Component = Textarea;
64
- props.autosize = true;
65
- props.minRows = 2;
64
+ props.autosize = props.autosize || true;
65
+ props.minRows = props.minRows || 2;
66
66
  } else {
67
67
  Component = TextInput;
68
68
  }
@@ -22,7 +22,8 @@ import Popover, { Props as PopoverProps } from '@client/components/containers/Po
22
22
  ----------------------------------*/
23
23
 
24
24
  export type Props = SelectProps & InputBaseProps<ComboboxItem> & {
25
- popoverProps?: PopoverProps
25
+ popoverProps?: PopoverProps,
26
+ buttonProps?: ButtonProps,
26
27
  }
27
28
 
28
29
  export type Choice = ComboboxItem;
@@ -63,7 +64,7 @@ export default (initProps: Props) => {
63
64
  onChange, value: current,
64
65
  required
65
66
  }, {
66
- multiple, choices: initChoices, enableSearch, popoverProps,
67
+ multiple, choices: initChoices, enableSearch, popoverProps, buttonProps,
67
68
  ...props
68
69
  }] = useMantineInput<Props, string|number>(initProps);
69
70
 
@@ -95,7 +96,8 @@ export default (initProps: Props) => {
95
96
  /*----------------------------------
96
97
  - ACTIONS
97
98
  ----------------------------------*/
98
-
99
+
100
+ // Load search results
99
101
  React.useEffect(() => {
100
102
 
101
103
  if (choicesViaFunc && opened) {
@@ -113,12 +115,16 @@ export default (initProps: Props) => {
113
115
 
114
116
  }, [
115
117
  opened,
116
- search.keywords,
117
- // When initChoices is a function, React considers it's always different
118
- // It avoids the choices are fetched everytimle the parent component is re-rendered
119
- typeof initChoices === 'function' ? true : initChoices
118
+ search.keywords
120
119
  ]);
121
120
 
121
+ // When initChoices is not a function and has changed
122
+ React.useEffect(() => {
123
+ if (!choicesViaFunc) {
124
+ setChoices(initChoices);
125
+ }
126
+ }, [initChoices]);
127
+
122
128
  /*----------------------------------
123
129
  - RENDER
124
130
  ----------------------------------*/
@@ -189,6 +195,7 @@ export default (initProps: Props) => {
189
195
  </div>
190
196
  )}>
191
197
  <Button
198
+ {...buttonProps}
192
199
  prefix={(
193
200
  (multiple && current?.length) ? (
194
201
  <span class="badge bg info s">
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "5htp-core",
3
3
  "description": "Convenient TypeScript framework designed for Performance and Productivity.",
4
- "version": "0.6.0-7",
4
+ "version": "0.6.0-72",
5
5
  "author": "Gaetan Le Gac (https://github.com/gaetanlegac)",
6
6
  "repository": "git://github.com/gaetanlegac/5htp-core.git",
7
7
  "license": "MIT",
@@ -34,9 +34,9 @@ export default class Facet<
34
34
 
35
35
  public findFirst(
36
36
  ...args: Parameters<S>
37
- ): Promise<R> {
37
+ ): Promise<R | null> {
38
38
  return this.delegate
39
39
  .findFirst(this.subset(...args))
40
- .then(this.transform)
40
+ .then(result => result ? this.transform(result) : null)
41
41
  }
42
42
  }
@@ -13,6 +13,10 @@ declare type With<
13
13
  TAdditionnal
14
14
  )
15
15
 
16
+ declare type NonNullFields<T, K extends keyof T> = Omit<T, K> & {
17
+ [P in K]: NonNullable<T[P]>;
18
+ };
19
+
16
20
  declare type ValueOf<T> = T[keyof T];
17
21
 
18
22
  // Extrait la valeur de retour d'une promise
package/types/icons.d.ts CHANGED
@@ -1 +1 @@
1
- export type TIcones = "times"|"solid/spinner-third"|"long-arrow-right"|"sack-dollar"|"bell"|"bullseye"|"project-diagram"|"user-friends"|"eye"|"lock"|"comments"|"phone"|"chalkboard-teacher"|"rocket"|"chart-bar"|"planet-ringed"|"brands/linkedin"|"user-circle"|"plus-circle"|"comments-alt"|"crosshairs"|"user-plus"|"mouse-pointer"|"thumbs-up"|"dollar-sign"|"arrow-right"|"user-shield"|"shield-alt"|"chart-line"|"money-bill-wave"|"star"|"link"|"file-alt"|"long-arrow-left"|"key"|"user"|"at"|"magnet"|"paper-plane"|"plus"|"binoculars"|"calendar-alt"|"search"|"lightbulb"|"envelope"|"solid/crown"|"brands/discord"|"pen"|"file"|"angle-up"|"angle-down"|"times-circle"|"info-circle"|"check-circle"|"exclamation-circle"|"check"|"usd-circle"|"users"|"arrow-left"|"meh-rolling-eyes"|"trash"|"solid/star"|"solid/star-half-alt"|"regular/star"|"chevron-left"|"cog"|"power-off"|"bars"|"play"|"minus-circle"|"question-circle"|"external-link"|"plane-departure"|"brands/whatsapp"|"wind"|"broom"|"exclamation-triangle"|"arrow-to-bottom"|"map-marker-alt"|"clock"|"ellipsis-h"|"solid/magic"|"industry"|"map-marker"|"calendar"|"briefcase"|"fire"|"globe"|"magic"|"building"|"graduation-cap"|"unlink"|"bold"|"italic"|"underline"|"strikethrough"|"subscript"|"superscript"|"code"|"font"|"empty-set"|"horizontal-rule"|"page-break"|"image"|"table"|"poll"|"columns"|"sticky-note"|"caret-right"|"align-left"|"align-center"|"align-right"|"align-justify"|"indent"|"outdent"|"list-ul"|"check-square"|"h1"|"h2"|"h3"|"h4"|"list-ol"|"paragraph"|"quote-left"
1
+ export type TIcones = "long-arrow-right"|"times"|"solid/spinner-third"|"sack-dollar"|"bell"|"bullseye"|"project-diagram"|"user-friends"|"eye"|"lock"|"comments"|"phone"|"chalkboard-teacher"|"rocket"|"chart-bar"|"planet-ringed"|"brands/linkedin"|"user-circle"|"crosshairs"|"arrow-right"|"plus-circle"|"comments-alt"|"user-shield"|"shield-alt"|"chart-line"|"money-bill-wave"|"star"|"link"|"file-alt"|"long-arrow-left"|"user-plus"|"mouse-pointer"|"thumbs-up"|"dollar-sign"|"key"|"user"|"at"|"magnet"|"paper-plane"|"plus"|"binoculars"|"times-circle"|"calendar-alt"|"search"|"lightbulb"|"angle-up"|"angle-down"|"solid/crown"|"brands/discord"|"pen"|"file"|"envelope"|"coins"|"angle-right"|"download"|"info-circle"|"check-circle"|"exclamation-circle"|"check"|"arrow-left"|"meh-rolling-eyes"|"trash"|"solid/star"|"solid/star-half-alt"|"regular/star"|"chevron-left"|"cog"|"power-off"|"users"|"bug"|"bars"|"question-circle"|"plane-departure"|"brands/whatsapp"|"wind"|"external-link"|"play"|"minus-circle"|"broom"|"exclamation-triangle"|"solid/check-circle"|"solid/exclamation-triangle"|"solid/times-circle"|"minus"|"clock"|"ellipsis-h"|"map-marker-alt"|"arrow-to-bottom"|"solid/magic"|"briefcase"|"map-marker"|"fire"|"globe"|"industry"|"calendar"|"magic"|"coin"|"building"|"graduation-cap"|"unlink"|"bold"|"italic"|"underline"|"strikethrough"|"subscript"|"superscript"|"code"|"font"|"empty-set"|"horizontal-rule"|"page-break"|"image"|"table"|"poll"|"columns"|"sticky-note"|"caret-right"|"align-left"|"align-center"|"align-right"|"align-justify"|"indent"|"outdent"|"list-ul"|"check-square"|"h1"|"h2"|"h3"|"h4"|"list-ol"|"paragraph"|"quote-left"