@carto/meridian-ds 2.5.0 → 2.5.2

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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,11 @@
4
4
 
5
5
  ## 2.0
6
6
 
7
+ ### 2.5.2
8
+
9
+ - Rename `useAutocompletion` to `useCodeAreaAutocompletion` [#275](https://github.com/CartoDB/meridian-ds/pull/275)
10
+ - Modify `useCodeAreaAutocompletion` interface to accept functions for a better memoization [#277](https://github.com/CartoDB/meridian-ds/pull/277)
11
+
7
12
  ### 2.5.0
8
13
 
9
14
  - Move widgets files: Co-located Files with Explicit Exports [#259](https://github.com/CartoDB/meridian-ds/pull/259)
@@ -5410,7 +5410,7 @@ function CodeAreaDialog({
5410
5410
  }
5411
5411
  );
5412
5412
  }
5413
- const useAutocompletion = (editor, config) => {
5413
+ const useCodeAreaAutocompletion = (editor, config) => {
5414
5414
  const { triggers } = config;
5415
5415
  React.useEffect(() => {
5416
5416
  if (!editor) return;
@@ -5446,10 +5446,7 @@ const useAutocompletion = (editor, config) => {
5446
5446
  closeHints(cm);
5447
5447
  return;
5448
5448
  }
5449
- const itemsForTrigger = foundTriggerConfig.items;
5450
- const filtered = itemsForTrigger.filter(
5451
- (item) => item.value.toLowerCase().includes(query.toLowerCase())
5452
- );
5449
+ const filtered = foundTriggerConfig.getItems(query);
5453
5450
  if (filtered.length === 0) {
5454
5451
  closeHints(cm);
5455
5452
  return;
@@ -5544,5 +5541,5 @@ exports.dialogDimensionsBySize = dialogDimensionsBySize;
5544
5541
  exports.isAutocompleteListGroupHeader = isAutocompleteListGroupHeader;
5545
5542
  exports.markTextPrecededBySymbol = markTextPrecededBySymbol;
5546
5543
  exports.useAutocomplete = useAutocomplete;
5547
- exports.useAutocompletion = useAutocompletion;
5544
+ exports.useCodeAreaAutocompletion = useCodeAreaAutocompletion;
5548
5545
  exports.useCopyValue = useCopyValue;
@@ -5410,7 +5410,7 @@ function CodeAreaDialog({
5410
5410
  }
5411
5411
  );
5412
5412
  }
5413
- const useAutocompletion = (editor, config) => {
5413
+ const useCodeAreaAutocompletion = (editor, config) => {
5414
5414
  const { triggers } = config;
5415
5415
  useEffect(() => {
5416
5416
  if (!editor) return;
@@ -5446,10 +5446,7 @@ const useAutocompletion = (editor, config) => {
5446
5446
  closeHints(cm);
5447
5447
  return;
5448
5448
  }
5449
- const itemsForTrigger = foundTriggerConfig.items;
5450
- const filtered = itemsForTrigger.filter(
5451
- (item) => item.value.toLowerCase().includes(query.toLowerCase())
5452
- );
5449
+ const filtered = foundTriggerConfig.getItems(query);
5453
5450
  if (filtered.length === 0) {
5454
5451
  closeHints(cm);
5455
5452
  return;
@@ -5545,6 +5542,6 @@ export {
5545
5542
  isAutocompleteListGroupHeader,
5546
5543
  markTextPrecededBySymbol,
5547
5544
  useAutocomplete,
5548
- useAutocompletion,
5545
+ useCodeAreaAutocompletion,
5549
5546
  useCopyValue
5550
5547
  };
@@ -6,7 +6,7 @@ export { default as CodeAreaField } from './CodeAreaField';
6
6
  export { default as CodeAreaFooter } from './CodeAreaFooter';
7
7
  export { default as CodeAreaHeader } from './CodeAreaHeader';
8
8
  export { default as CodeAreaInput } from './CodeAreaInput';
9
- export { useAutocompletion } from './useAutocompletion';
9
+ export { useCodeAreaAutocompletion } from './useCodeAreaAutocompletion';
10
10
  export { CodeAreaMarkTextPattern, markTextPrecededBySymbol } from './utils';
11
- export type { AutocompletionConfig, AutocompleteItem, TriggerConfig, } from './useAutocompletion';
11
+ export type { AutocompletionConfig, AutocompleteItem, TriggerConfig, } from './useCodeAreaAutocompletion';
12
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/CodeArea/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAC3E,OAAO,EAAE,OAAO,IAAI,qBAAq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AyB,EAAE,MAAM,6BAA6B,CAAA;AACvE,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAA;AAE3E,YAAY,EACV,oBAAoB,EACpB,gBAAgB,EAChB,aAAa,GACd,MAAM,6BAA6B,CAAA"}
@@ -8,8 +8,8 @@ export interface AutocompleteItem {
8
8
  export interface TriggerConfig {
9
9
  /** The trigger character (e.g., '@', '/', '#') */
10
10
  symbol: string;
11
- /** List of items to show for this trigger */
12
- items: AutocompleteItem[];
11
+ /** Function that returns items to show for this trigger, receives the current query for filtering */
12
+ getItems: (query: string) => AutocompleteItem[];
13
13
  }
14
14
  export interface AutocompletionConfig {
15
15
  /** Array of trigger configurations */
@@ -29,24 +29,24 @@ export interface AutocompletionConfig {
29
29
  * triggers: [
30
30
  * {
31
31
  * symbol: '@',
32
- * items: [
32
+ * getItems: (query) => [
33
33
  * { value: 'user1', html: '<div class="user-item">👤 John Doe</div>' },
34
34
  * { value: 'admin1', html: '<div class="admin-item">👑 Alice Admin</div>' }
35
- * ]
35
+ * ].filter(item => item.value.toLowerCase().includes(query.toLowerCase()))
36
36
  * },
37
37
  * {
38
38
  * symbol: '/',
39
- * items: [
39
+ * getItems: (query) => [
40
40
  * { value: 'help', html: '<div class="command-item">📖 Show help</div>' },
41
41
  * { value: 'save', html: '<div class="command-item">💾 Save document</div>' }
42
- * ]
42
+ * ].filter(item => item.value.toLowerCase().includes(query.toLowerCase()))
43
43
  * },
44
44
  * {
45
45
  * symbol: '#',
46
- * items: [
46
+ * getItems: (query) => [
47
47
  * { value: 'urgent', html: '<div class="tag-item">🔴 Urgent</div>' },
48
48
  * { value: 'review', html: '<div class="tag-item">👀 Needs review</div>' }
49
- * ]
49
+ * ].filter(item => item.value.toLowerCase().includes(query.toLowerCase()))
50
50
  * }
51
51
  * ]
52
52
  * })
@@ -58,5 +58,5 @@ export interface AutocompletionConfig {
58
58
  * <CodeAreaField ... onEditorDidMount={handleEditorMount} />
59
59
  * ```
60
60
  */
61
- export declare const useAutocompletion: (editor: Editor | null, config: AutocompletionConfig) => void;
62
- //# sourceMappingURL=useAutocompletion.d.ts.map
61
+ export declare const useCodeAreaAutocompletion: (editor: Editor | null, config: AutocompletionConfig) => void;
62
+ //# sourceMappingURL=useCodeAreaAutocompletion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCodeAreaAutocompletion.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/CodeArea/useCodeAreaAutocompletion.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAGxC,MAAM,WAAW,gBAAgB;IAC/B,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAA;IACb,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,aAAa;IAC5B,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAA;IACd,qGAAqG;IACrG,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,gBAAgB,EAAE,CAAA;CAChD;AAED,MAAM,WAAW,oBAAoB;IACnC,sCAAsC;IACtC,QAAQ,EAAE,aAAa,EAAE,CAAA;CAC1B;AASD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,eAAO,MAAM,yBAAyB,WAC5B,MAAM,GAAG,IAAI,UACb,oBAAoB,SAqF7B,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carto/meridian-ds",
3
- "version": "2.5.0",
3
+ "version": "2.5.2",
4
4
  "description": "CARTO Meridian Design System",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -1 +0,0 @@
1
- {"version":3,"file":"useAutocompletion.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/CodeArea/useAutocompletion.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAGxC,MAAM,WAAW,gBAAgB;IAC/B,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAA;IACb,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,aAAa;IAC5B,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAA;IACd,6CAA6C;IAC7C,KAAK,EAAE,gBAAgB,EAAE,CAAA;CAC1B;AAED,MAAM,WAAW,oBAAoB;IACnC,sCAAsC;IACtC,QAAQ,EAAE,aAAa,EAAE,CAAA;CAC1B;AASD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,eAAO,MAAM,iBAAiB,WACpB,MAAM,GAAG,IAAI,UACb,oBAAoB,SAwF7B,CAAA"}