@carto/meridian-ds 2.5.0 → 2.5.3

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,15 @@
4
4
 
5
5
  ## 2.0
6
6
 
7
+ ### 2.5.3
8
+
9
+ - Support `tooltipLabel` + `disabled` properties in `FilterDropdown` [#279](https://github.com/CartoDB/meridian-ds/pull/279)
10
+
11
+ ### 2.5.2
12
+
13
+ - Rename `useAutocompletion` to `useCodeAreaAutocompletion` [#275](https://github.com/CartoDB/meridian-ds/pull/275)
14
+ - Modify `useCodeAreaAutocompletion` interface to accept functions for a better memoization [#277](https://github.com/CartoDB/meridian-ds/pull/277)
15
+
7
16
  ### 2.5.0
8
17
 
9
18
  - Move widgets files: Co-located Files with Explicit Exports [#259](https://github.com/CartoDB/meridian-ds/pull/259)
@@ -1574,6 +1574,13 @@ const FilterDropdownMenuItem = ({
1574
1574
  "aria-label": ariaLabel,
1575
1575
  "aria-labelledby": menuItemId,
1576
1576
  "aria-selected": isSelected,
1577
+ sx: {
1578
+ ...disabled && tooltipLabel && {
1579
+ // This ensures the Tooltip is shown when disabled, without wrapping it with a span/div,
1580
+ // otherwise this will invalid from an A11Y perspective plus not navigable through the keyboard
1581
+ pointerEvents: "auto !important"
1582
+ }
1583
+ },
1577
1584
  children: [
1578
1585
  startAdornment && /* @__PURE__ */ jsxRuntime.jsx(material.ListItemIcon, { children: startAdornment }),
1579
1586
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -5410,7 +5417,7 @@ function CodeAreaDialog({
5410
5417
  }
5411
5418
  );
5412
5419
  }
5413
- const useAutocompletion = (editor, config) => {
5420
+ const useCodeAreaAutocompletion = (editor, config) => {
5414
5421
  const { triggers } = config;
5415
5422
  React.useEffect(() => {
5416
5423
  if (!editor) return;
@@ -5446,10 +5453,7 @@ const useAutocompletion = (editor, config) => {
5446
5453
  closeHints(cm);
5447
5454
  return;
5448
5455
  }
5449
- const itemsForTrigger = foundTriggerConfig.items;
5450
- const filtered = itemsForTrigger.filter(
5451
- (item) => item.value.toLowerCase().includes(query.toLowerCase())
5452
- );
5456
+ const filtered = foundTriggerConfig.getItems(query);
5453
5457
  if (filtered.length === 0) {
5454
5458
  closeHints(cm);
5455
5459
  return;
@@ -5544,5 +5548,5 @@ exports.dialogDimensionsBySize = dialogDimensionsBySize;
5544
5548
  exports.isAutocompleteListGroupHeader = isAutocompleteListGroupHeader;
5545
5549
  exports.markTextPrecededBySymbol = markTextPrecededBySymbol;
5546
5550
  exports.useAutocomplete = useAutocomplete;
5547
- exports.useAutocompletion = useAutocompletion;
5551
+ exports.useCodeAreaAutocompletion = useCodeAreaAutocompletion;
5548
5552
  exports.useCopyValue = useCopyValue;
@@ -1574,6 +1574,13 @@ const FilterDropdownMenuItem = ({
1574
1574
  "aria-label": ariaLabel,
1575
1575
  "aria-labelledby": menuItemId,
1576
1576
  "aria-selected": isSelected,
1577
+ sx: {
1578
+ ...disabled && tooltipLabel && {
1579
+ // This ensures the Tooltip is shown when disabled, without wrapping it with a span/div,
1580
+ // otherwise this will invalid from an A11Y perspective plus not navigable through the keyboard
1581
+ pointerEvents: "auto !important"
1582
+ }
1583
+ },
1577
1584
  children: [
1578
1585
  startAdornment && /* @__PURE__ */ jsx(ListItemIcon, { children: startAdornment }),
1579
1586
  /* @__PURE__ */ jsx(
@@ -5410,7 +5417,7 @@ function CodeAreaDialog({
5410
5417
  }
5411
5418
  );
5412
5419
  }
5413
- const useAutocompletion = (editor, config) => {
5420
+ const useCodeAreaAutocompletion = (editor, config) => {
5414
5421
  const { triggers } = config;
5415
5422
  useEffect(() => {
5416
5423
  if (!editor) return;
@@ -5446,10 +5453,7 @@ const useAutocompletion = (editor, config) => {
5446
5453
  closeHints(cm);
5447
5454
  return;
5448
5455
  }
5449
- const itemsForTrigger = foundTriggerConfig.items;
5450
- const filtered = itemsForTrigger.filter(
5451
- (item) => item.value.toLowerCase().includes(query.toLowerCase())
5452
- );
5456
+ const filtered = foundTriggerConfig.getItems(query);
5453
5457
  if (filtered.length === 0) {
5454
5458
  closeHints(cm);
5455
5459
  return;
@@ -5545,6 +5549,6 @@ export {
5545
5549
  isAutocompleteListGroupHeader,
5546
5550
  markTextPrecededBySymbol,
5547
5551
  useAutocomplete,
5548
- useAutocompletion,
5552
+ useCodeAreaAutocompletion,
5549
5553
  useCopyValue
5550
5554
  };
@@ -1 +1 @@
1
- {"version":3,"file":"FilterDropdownMenuItem.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/FilterDropdown/FilterDropdownMenuItem.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAA;AAErD,eAAO,MAAM,sBAAsB,4DAMhC,2BAA2B,mDAsD7B,CAAA"}
1
+ {"version":3,"file":"FilterDropdownMenuItem.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/FilterDropdown/FilterDropdownMenuItem.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAA;AAErD,eAAO,MAAM,sBAAsB,4DAMhC,2BAA2B,mDA8D7B,CAAA"}
@@ -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,qBAAqB,EAAE,MAAM,wCAAwC,CAAA;AACzF,OAAO,EAAE,OAAO,IAAI,0BAA0B,EAAE,MAAM,6CAA6C,CAAA;AACnG,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,sCAAsC,CAAA;AACrF,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAA;AAE3E,YAAY,EACV,oBAAoB,EACpB,gBAAgB,EAChB,aAAa,GACd,MAAM,qBAAqB,CAAA"}
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,qBAAqB,EAAE,MAAM,wCAAwC,CAAA;AACzF,OAAO,EAAE,OAAO,IAAI,0BAA0B,EAAE,MAAM,6CAA6C,CAAA;AACnG,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,sCAAsC,CAAA;AACrF,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,yBAAyB,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.3",
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"}