@ember-eui/core 16.0.2 → 16.0.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.
@@ -1 +1 @@
1
- {"version":3,"file":"eui-config.js","sources":["../../src/services/eui-config.ts"],"sourcesContent":["import { tracked } from '@glimmer/tracking';\nimport Service from '@ember/service';\n\nimport { merge } from 'lodash-es';\n\nimport type { EuiButtonIconSignature } from '../components/eui-button-icon';\nimport type { ComponentLike } from '@glint/template';\n\n/**\n * Defaults for components' props, like upstream `EuiProvider`'s\n * `componentDefaults` (app-wide here). Args passed to a component win.\n */\nexport interface EuiComponentDefaults {\n /**\n * Page size settings inherited by `EuiTablePagination` and every table\n * and grid built on it (`EuiBasicTable`, `EuiInMemoryTable`,\n * `EuiDataGrid`).\n */\n EuiTablePagination?: {\n itemsPerPage?: number;\n itemsPerPageOptions?: number[];\n showPerPageOptions?: boolean;\n };\n}\n\nexport interface EuiConfig {\n /**\n * Extra icons usable by name, e.g. `<EuiIcon @type=\"myLogo\" />` or\n * `<EuiButton @iconType=\"myLogo\">`. Values are components rendering an\n * `<svg>` with `...attributes`, for example svgs imported with\n * @svg-jar/plugin: `import MyLogo from './my-logo.svg';`\n */\n 'euiIcon.icons'?: Record<\n string,\n ComponentLike<{ Element: SVGSVGElement; Blocks: { default: [] } }>\n >;\n /** @deprecated no longer has any effect, see `euiIcon.icons` */\n 'euiIcon.useSvg'?: boolean;\n /** @deprecated no longer has any effect, see `euiIcon.icons` */\n euiIconUseSvg?: boolean;\n 'euiButtonIcon.size'?: EuiButtonIconSignature['Args']['iconSize'];\n euiComboBoxOptionsHeight?: number;\n /**\n * Upstream `EuiProvider componentDefaults`, e.g.\n * `{ EuiTablePagination: { itemsPerPage: 25, itemsPerPageOptions: [25, 50, 100] } }`.\n * Set it with `setConfig` or a single `updateConfig` call: `updateConfig`\n * merges arrays by index into earlier values.\n */\n componentDefaults?: EuiComponentDefaults;\n}\n\nconst DEFAULT_CONFIG: EuiConfig = {\n 'euiIcon.useSvg': true,\n euiIconUseSvg: true,\n euiComboBoxOptionsHeight: 29\n};\n\nexport default class EuiConfigService extends Service {\n @tracked private _config: EuiConfig = DEFAULT_CONFIG;\n\n getConfig<T extends keyof EuiConfig>(key: T): EuiConfig[T] | undefined {\n return this._config[key];\n }\n\n updateConfig(config: Partial<EuiConfig>) {\n this._config = merge<Partial<EuiConfig>, EuiConfig, Partial<EuiConfig>>(\n {},\n this._config,\n config\n );\n }\n\n setConfig(config: EuiConfig) {\n this._config = config;\n }\n}\n"],"names":["DEFAULT_CONFIG","euiIconUseSvg","euiComboBoxOptionsHeight","EuiConfigService","Service","g","prototype","tracked","i","getConfig","key","_config","updateConfig","config","merge","setConfig"],"mappings":";;;;;AAmDA,MAAMA,cAAyB,GAAG;AAChC,EAAA,gBAAgB,EAAE,IAAI;AACtBC,EAAAA,aAAa,EAAE,IAAI;AACnBC,EAAAA,wBAAwB,EAAE;AAC5B,CAAC;AAEc,MAAMC,gBAAgB,SAASC,OAAO,CAAC;AAAA,EAAA;IAAAC,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,SAAA,EAAA,CACnDC,OAAO,CAAA,EAAA,YAAA;AAAA,MAAA,OAA8BP,cAAc;AAAA,IAAA,CAAA,CAAA;AAAA;EAAA,QAAA,IAAAQ,CAAA,CAAA,IAAA,EAAA,SAAA,CAAA,EAAA,MAAA;EAEpDC,SAASA,CAA4BC,GAAM,EAA4B;AACrE,IAAA,OAAO,IAAI,CAACC,OAAO,CAACD,GAAG,CAAC;AAC1B,EAAA;EAEAE,YAAYA,CAACC,MAA0B,EAAE;AACvC,IAAA,IAAI,CAACF,OAAO,GAAGG,KAAK,CAClB,EAAE,EACF,IAAI,CAACH,OAAO,EACZE,MACF,CAAC;AACH,EAAA;EAEAE,SAASA,CAACF,MAAiB,EAAE;IAC3B,IAAI,CAACF,OAAO,GAAGE,MAAM;AACvB,EAAA;AACF;;"}
1
+ {"version":3,"file":"eui-config.js","sources":["../../src/services/eui-config.ts"],"sourcesContent":["import { tracked } from '@glimmer/tracking';\nimport Service from '@ember/service';\n\nimport { merge } from 'lodash-es';\n\nimport type { EuiButtonIconSignature } from '../components/eui-button-icon';\nimport type { ComponentLike } from '@glint/template';\n\n/**\n * Defaults for components' props, like upstream `EuiProvider`'s\n * `componentDefaults` (app-wide here). Args passed to a component win.\n */\nexport interface EuiComponentDefaults {\n /**\n * Page size settings inherited by `EuiTablePagination` and every table\n * and grid built on it (`EuiBasicTable`, `EuiInMemoryTable`,\n * `EuiDataGrid`).\n */\n EuiTablePagination?: {\n itemsPerPage?: number;\n itemsPerPageOptions?: number[];\n showPerPageOptions?: boolean;\n };\n}\n\nexport interface EuiConfig {\n /**\n * Extra icons usable by name, e.g. `<EuiIcon @type=\"myLogo\" />` or\n * `<EuiButton @iconType=\"myLogo\">`. Values are components rendering an\n * `<svg>` with `...attributes`, for example svgs imported with\n * @svg-jar/plugin: `import MyLogo from './my-logo.svg';`\n */\n 'euiIcon.icons'?: Record<\n string,\n ComponentLike<{ Element: SVGSVGElement; Blocks: { default: [] } }>\n >;\n /** @deprecated no longer has any effect, see `euiIcon.icons` */\n 'euiIcon.useSvg'?: boolean;\n /** @deprecated no longer has any effect, see `euiIcon.icons` */\n euiIconUseSvg?: boolean;\n 'euiButtonIcon.size'?: EuiButtonIconSignature['Args']['iconSize'];\n euiComboBoxOptionsHeight?: number;\n /**\n * Default of `EuiComboBox`'s `@ignoreAccents`: match options ignoring\n * accents (\"medico\" finds \"Médico\"). Upstream: `false`.\n */\n 'euiComboBox.ignoreAccents'?: boolean;\n /**\n * Upstream `EuiProvider componentDefaults`, e.g.\n * `{ EuiTablePagination: { itemsPerPage: 25, itemsPerPageOptions: [25, 50, 100] } }`.\n * Set it with `setConfig` or a single `updateConfig` call: `updateConfig`\n * merges arrays by index into earlier values.\n */\n componentDefaults?: EuiComponentDefaults;\n}\n\nconst DEFAULT_CONFIG: EuiConfig = {\n 'euiIcon.useSvg': true,\n euiIconUseSvg: true,\n euiComboBoxOptionsHeight: 29\n};\n\nexport default class EuiConfigService extends Service {\n @tracked private _config: EuiConfig = DEFAULT_CONFIG;\n\n getConfig<T extends keyof EuiConfig>(key: T): EuiConfig[T] | undefined {\n return this._config[key];\n }\n\n updateConfig(config: Partial<EuiConfig>) {\n this._config = merge<Partial<EuiConfig>, EuiConfig, Partial<EuiConfig>>(\n {},\n this._config,\n config\n );\n }\n\n setConfig(config: EuiConfig) {\n this._config = config;\n }\n}\n"],"names":["DEFAULT_CONFIG","euiIconUseSvg","euiComboBoxOptionsHeight","EuiConfigService","Service","g","prototype","tracked","i","getConfig","key","_config","updateConfig","config","merge","setConfig"],"mappings":";;;;;AAwDA,MAAMA,cAAyB,GAAG;AAChC,EAAA,gBAAgB,EAAE,IAAI;AACtBC,EAAAA,aAAa,EAAE,IAAI;AACnBC,EAAAA,wBAAwB,EAAE;AAC5B,CAAC;AAEc,MAAMC,gBAAgB,SAASC,OAAO,CAAC;AAAA,EAAA;IAAAC,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,SAAA,EAAA,CACnDC,OAAO,CAAA,EAAA,YAAA;AAAA,MAAA,OAA8BP,cAAc;AAAA,IAAA,CAAA,CAAA;AAAA;EAAA,QAAA,IAAAQ,CAAA,CAAA,IAAA,EAAA,SAAA,CAAA,EAAA,MAAA;EAEpDC,SAASA,CAA4BC,GAAM,EAA4B;AACrE,IAAA,OAAO,IAAI,CAACC,OAAO,CAACD,GAAG,CAAC;AAC1B,EAAA;EAEAE,YAAYA,CAACC,MAA0B,EAAE;AACvC,IAAA,IAAI,CAACF,OAAO,GAAGG,KAAK,CAClB,EAAE,EACF,IAAI,CAACH,OAAO,EACZE,MACF,CAAC;AACH,EAAA;EAEAE,SAASA,CAACF,MAAiB,EAAE;IAC3B,IAAI,CAACF,OAAO,GAAGE,MAAM;AACvB,EAAA;AACF;;"}
@@ -67,16 +67,20 @@ function flattenOptionGroups(options) {
67
67
  * Upstream `createPartialStringEqualityOptionMatcher`: options whose label
68
68
  * (trimmed) includes the normalized search text.
69
69
  */
70
- function createPartialStringEqualityOptionMatcher(searchField) {
70
+ function createPartialStringEqualityOptionMatcher(searchField, ignoreAccents = false) {
71
+ const fold = ignoreAccents ? removeAccents : text => text;
71
72
  return ({
72
73
  option,
73
74
  isCaseSensitive,
74
75
  normalizedSearchValue
75
76
  }) => {
76
77
  if (!normalizedSearchValue) return true;
77
- return transformForCaseSensitivity(comboBoxOptionLabel(option, searchField).trim(), isCaseSensitive).includes(normalizedSearchValue);
78
+ return fold(transformForCaseSensitivity(comboBoxOptionLabel(option, searchField).trim(), isCaseSensitive)).includes(fold(normalizedSearchValue));
78
79
  };
79
80
  }
81
+
82
+ /** "Médico" -> "Medico": accents (any combining mark) off. */
83
+ const removeAccents = text => text.normalize('NFD').replace(/\p{M}/gu, '');
80
84
  const keyOf = option => option && typeof option === 'object' ? option.key : undefined;
81
85
 
82
86
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"combo-box.js","sources":["../../../src/utils/eui/combo-box.ts"],"sourcesContent":["/**\n * Combo box helpers. The group label style port it needs is shared with\n * EuiSelectableList (`utils/eui/selectable.ts`).\n */\nimport type { CSSObject } from '@emotion/css/create-instance';\n\n/**\n * Ember has no React global reset: box sizing for the combo box's own\n * elements (upstream `*` reset) and the list's `button`-free rows.\n */\nexport const comboBoxBoxReset: CSSObject = {\n boxSizing: 'border-box',\n '& :where(*, *::before, *::after)': { boxSizing: 'border-box' }\n};\n\n/** The text of an option: strings as they are, else `label` (or `@searchField`). */\nexport function comboBoxOptionLabel(option: unknown, searchField?: string): string {\n if (typeof option === 'string') return option;\n if (typeof option === 'number') return String(option);\n if (option && typeof option === 'object') {\n const record = option as Record<string, unknown>;\n const value = record[searchField ?? 'label'] ?? record['label'];\n\n if (typeof value === 'string' || typeof value === 'number') {\n return String(value);\n }\n }\n\n return '';\n}\n\n/*\n * Matching helpers below are ported from @elastic/eui 123.1.0\n * `components/combo_box/matching_options.ts` and `combo_box/utils.tsx`.\n * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under\n * one or more contributor license agreements. Licensed under the Elastic\n * License 2.0 or the Server Side Public License, v 1; see vendor/eui-latest.\n */\n\n/** Upstream `SortMatchesBy`. */\nexport type EuiComboBoxSortMatchesBy = 'none' | 'startsWith';\n\n/** Upstream `transformForCaseSensitivity`. */\nexport const transformForCaseSensitivity = (\n text: string,\n isCaseSensitive?: boolean\n): string => (isCaseSensitive ? text : text.toLowerCase());\n\n/**\n * A group: upstream's `{ label, options }` or ember-power-select's\n * `{ groupName, options }`.\n */\nexport const isComboBoxGroup = (\n option: unknown\n): option is { options: unknown[]; groupName?: string; label?: string } =>\n Boolean(\n option &&\n typeof option === 'object' &&\n Array.isArray((option as { options?: unknown }).options)\n );\n\n/** The title of a group (`groupName`, else upstream's `label`). */\nexport const comboBoxGroupLabel = (group: {\n groupName?: string;\n label?: string;\n}): string => String(group.groupName ?? group.label ?? '');\n\n/** Upstream `flattenOptionGroups`: the options of groups, in one list. */\nexport function flattenOptionGroups(options: readonly unknown[]): unknown[] {\n return options.reduce<unknown[]>((all, option) => {\n if (isComboBoxGroup(option)) return all.concat(option.options);\n all.push(option);\n\n return all;\n }, []);\n}\n\n/** Upstream `EuiComboBoxOptionMatcherArgs`. */\nexport interface EuiComboBoxOptionMatcherArgs {\n /** The option being matched. */\n option: any;\n /** The search text, as typed. */\n searchValue: string;\n /** The search text trimmed, and lower case unless case-sensitive. */\n normalizedSearchValue: string;\n /** Whether matching is case-sensitive. */\n isCaseSensitive: boolean;\n}\n\n/** Upstream `EuiComboBoxOptionMatcher`: `true` when the option matches. */\nexport type EuiComboBoxOptionMatcher = (\n args: EuiComboBoxOptionMatcherArgs\n) => boolean;\n\n/**\n * Upstream `createPartialStringEqualityOptionMatcher`: options whose label\n * (trimmed) includes the normalized search text.\n */\nexport function createPartialStringEqualityOptionMatcher(\n searchField?: string\n): EuiComboBoxOptionMatcher {\n return ({ option, isCaseSensitive, normalizedSearchValue }) => {\n if (!normalizedSearchValue) return true;\n\n return transformForCaseSensitivity(\n comboBoxOptionLabel(option, searchField).trim(),\n isCaseSensitive\n ).includes(normalizedSearchValue);\n };\n}\n\nconst keyOf = (option: unknown): unknown =>\n option && typeof option === 'object'\n ? (option as { key?: unknown }).key\n : undefined;\n\n/**\n * Upstream's \"already selected\" test of `getMatchingOptions`: a selected\n * option has the same label (case per `isCaseSensitive`) and, when the\n * option has a `key`, the same key. The same object always is.\n */\nexport function isComboBoxOptionSelected(\n option: unknown,\n selectedOptions: readonly unknown[],\n searchField?: string,\n isCaseSensitive?: boolean\n): boolean {\n if (!selectedOptions.length) return false;\n if (selectedOptions.includes(option)) return true;\n\n const label = comboBoxOptionLabel(option, searchField);\n\n if (!label) return false;\n\n const normalized = transformForCaseSensitivity(label, isCaseSensitive);\n const key = keyOf(option);\n\n return selectedOptions.some(\n (selected) =>\n transformForCaseSensitivity(\n comboBoxOptionLabel(selected, searchField),\n isCaseSensitive\n ) === normalized &&\n (key === undefined || keyOf(selected) === key)\n );\n}\n\n/**\n * Upstream single selection check mark: the selected option has the same\n * label and key (or is the same object).\n */\nexport function isComboBoxOptionChecked(\n option: unknown,\n selectedOptions: readonly unknown[] | undefined,\n searchField?: string\n): boolean {\n const selected = selectedOptions?.[0];\n\n if (selected === undefined) return false;\n if (selected === option) return true;\n\n const label = comboBoxOptionLabel(option, searchField);\n\n return (\n Boolean(label) &&\n comboBoxOptionLabel(selected, searchField) === label &&\n keyOf(selected) === keyOf(option)\n );\n}\n\ninterface GetMatchingOptions {\n options: readonly unknown[];\n selectedOptions: readonly unknown[];\n searchValue: string;\n optionMatcher: EuiComboBoxOptionMatcher;\n searchField?: string;\n isCaseSensitive?: boolean;\n isPreFiltered?: boolean;\n showPrevSelected?: boolean;\n sortMatchesBy?: EuiComboBoxSortMatchesBy;\n}\n\n/** A group title in the flat list of matches (upstream `isGroupLabelOption`). */\nexport interface ComboBoxGroupLabel {\n isGroupLabelOption: true;\n group: { options: unknown[]; groupName?: string; label?: string };\n}\n\nexport const isComboBoxGroupLabel = (\n entry: unknown\n): entry is ComboBoxGroupLabel =>\n Boolean(\n entry &&\n typeof entry === 'object' &&\n (entry as ComboBoxGroupLabel).isGroupLabelOption === true &&\n 'group' in entry\n );\n\n/**\n * Upstream `getMatchingOptions`, as a flat list with group titles: the\n * options (not yet selected, unless `showPrevSelected`) matching the search\n * text, groups with matches preceded by their title, and with\n * `sortMatchesBy: 'startsWith'` the entries (titles included) whose label\n * starts with the search text first.\n */\nexport function getMatchingEntries({\n options,\n selectedOptions,\n searchValue,\n optionMatcher,\n searchField,\n isCaseSensitive = false,\n isPreFiltered = false,\n showPrevSelected = false,\n sortMatchesBy = 'none'\n}: GetMatchingOptions): unknown[] {\n const normalizedSearchValue = transformForCaseSensitivity(\n searchValue.trim(),\n isCaseSensitive\n );\n let entries: unknown[] = [];\n\n const collect = (accumulator: unknown[], option: unknown) => {\n // only options not selected yet, unless requested\n if (\n !showPrevSelected &&\n isComboBoxOptionSelected(\n option,\n selectedOptions,\n searchField,\n isCaseSensitive\n )\n ) {\n return;\n }\n\n if (\n isPreFiltered ||\n !normalizedSearchValue ||\n optionMatcher({\n option,\n searchValue,\n normalizedSearchValue,\n isCaseSensitive\n })\n ) {\n accumulator.push(option);\n }\n };\n\n options.forEach((option) => {\n if (isComboBoxGroup(option)) {\n const matches: unknown[] = [];\n\n option.options.forEach((child) => collect(matches, child));\n\n if (matches.length > 0) {\n entries.push({ isGroupLabelOption: true, group: option });\n // concat over spreading, for large groups (upstream)\n entries = entries.concat(matches);\n }\n } else {\n collect(entries, option);\n }\n });\n\n if (sortMatchesBy === 'startsWith') {\n const startWith: unknown[] = [];\n const others: unknown[] = [];\n\n entries.forEach((entry) => {\n const label = isComboBoxGroupLabel(entry)\n ? comboBoxGroupLabel(entry.group)\n : comboBoxOptionLabel(entry, searchField);\n\n (transformForCaseSensitivity(label, isCaseSensitive).startsWith(\n normalizedSearchValue\n )\n ? startWith\n : others\n ).push(entry);\n });\n\n return [...startWith, ...others];\n }\n\n return entries;\n}\n\n/**\n * The flat list of matches as ember-power-select options: every option\n * after a group title belongs to that group (as rendered upstream), the\n * others are top level. Groups are copies with the matching options (and a\n * `groupName`), the options themselves are never copied.\n */\nexport function entriesToPowerSelectOptions(entries: readonly unknown[]) {\n const result: unknown[] = [];\n let current: { options: unknown[]; groupName?: string } | undefined;\n\n entries.forEach((entry) => {\n if (isComboBoxGroupLabel(entry)) {\n current = {\n ...entry.group,\n groupName: comboBoxGroupLabel(entry.group),\n options: []\n };\n result.push(current);\n } else if (current) {\n current.options.push(entry);\n } else {\n result.push(entry);\n }\n });\n\n return result;\n}\n\n/**\n * Groups and their options in one list (group objects included), the rows\n * of EuiComboBox's list and upstream's `matchingOptions` order.\n */\nexport function flattenComboBoxRows(options: readonly unknown[]): unknown[] {\n const rows: unknown[] = [];\n\n options.forEach((option) => {\n if (isComboBoxGroup(option) && 'groupName' in option) {\n rows.push(option);\n option.options.forEach((child) => rows.push(child));\n } else {\n rows.push(option);\n }\n });\n\n return rows;\n}\n\n/** An option that can be highlighted or chosen (not a group, not disabled). */\nexport const isSelectableRow = (row: unknown, group?: unknown): boolean =>\n !(isComboBoxGroup(row) && 'groupName' in (row as object)) &&\n !(\n row &&\n typeof row === 'object' &&\n (row as { disabled?: boolean }).disabled === true\n ) &&\n !(\n group &&\n typeof group === 'object' &&\n (group as { disabled?: boolean }).disabled === true\n );\n\n/**\n * Upstream `findNextSelectableOptionIndex`: from `startIndex`, the first\n * selectable row in `direction`, wrapping around; `-1` when none.\n */\nexport function findNextSelectableIndex(\n rows: readonly unknown[],\n selectable: (index: number) => boolean,\n startIndex: number,\n direction: 1 | -1 = 1\n): number {\n if (!rows.length) return -1;\n\n let index = startIndex;\n\n for (let count = 0; count < rows.length; count++) {\n if (selectable(index)) return index;\n\n index = (index + direction + rows.length) % rows.length;\n }\n\n return -1;\n}\n\n/**\n * Upstream `getSelectedOptionForSearchValue`: the selected option whose\n * label equals the text.\n */\nexport function selectedOptionForSearchValue(\n selectedOptions: readonly unknown[],\n searchValue: string,\n searchField: string | undefined,\n isCaseSensitive?: boolean\n): unknown {\n const search = transformForCaseSensitivity(searchValue, isCaseSensitive);\n\n return selectedOptions.find(\n (option) =>\n transformForCaseSensitivity(\n comboBoxOptionLabel(option, searchField),\n isCaseSensitive\n ) === search\n );\n}\n\n/**\n * Upstream `EuiComboBoxOptionAppendPrepend` spacing: margin between an\n * option's `prepend` / `append` and its text, with block icons so they\n * align with the text.\n */\nexport function comboBoxAppendPrependStyles(\n margin: string\n): { prepend: CSSObject; append: CSSObject } {\n const centerIcons = { '.euiIcon': { display: 'block' } };\n\n return {\n prepend: { marginInlineEnd: margin, ...centerIcons },\n append: { marginInlineStart: margin, ...centerIcons }\n };\n}\n\n/**\n * Option `prepend` / `append` and EuiComboBox's `@prepend` / `@append`:\n * text, or a component (rendered with the option as `@option`).\n */\nexport const isTextNode = (value: unknown): boolean =>\n typeof value === 'string' ||\n typeof value === 'number' ||\n // htmlSafe strings render as HTML, like text\n (Boolean(value) &&\n typeof value === 'object' &&\n typeof (value as { toHTML?: unknown }).toHTML === 'function');\n"],"names":["comboBoxBoxReset","boxSizing","comboBoxOptionLabel","option","searchField","String","record","value","transformForCaseSensitivity","text","isCaseSensitive","toLowerCase","isComboBoxGroup","Boolean","Array","isArray","options","comboBoxGroupLabel","group","groupName","label","flattenOptionGroups","reduce","all","concat","push","createPartialStringEqualityOptionMatcher","normalizedSearchValue","trim","includes","keyOf","key","undefined","isComboBoxOptionSelected","selectedOptions","length","normalized","some","selected","isComboBoxOptionChecked","isComboBoxGroupLabel","entry","isGroupLabelOption","getMatchingEntries","searchValue","optionMatcher","isPreFiltered","showPrevSelected","sortMatchesBy","entries","collect","accumulator","forEach","matches","child","startWith","others","startsWith","entriesToPowerSelectOptions","result","current","flattenComboBoxRows","rows","isSelectableRow","row","disabled","findNextSelectableIndex","selectable","startIndex","direction","index","count","selectedOptionForSearchValue","search","find","comboBoxAppendPrependStyles","margin","centerIcons","display","prepend","marginInlineEnd","append","marginInlineStart","isTextNode","toHTML"],"mappings":"AAAA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACO,MAAMA,gBAA2B,GAAG;AACzCC,EAAAA,SAAS,EAAE,YAAY;AACvB,EAAA,kCAAkC,EAAE;AAAEA,IAAAA,SAAS,EAAE;AAAa;AAChE;;AAEA;AACO,SAASC,mBAAmBA,CAACC,MAAe,EAAEC,WAAoB,EAAU;AACjF,EAAA,IAAI,OAAOD,MAAM,KAAK,QAAQ,EAAE,OAAOA,MAAM;EAC7C,IAAI,OAAOA,MAAM,KAAK,QAAQ,EAAE,OAAOE,MAAM,CAACF,MAAM,CAAC;AACrD,EAAA,IAAIA,MAAM,IAAI,OAAOA,MAAM,KAAK,QAAQ,EAAE;IACxC,MAAMG,MAAM,GAAGH,MAAiC;AAChD,IAAA,MAAMI,KAAK,GAAGD,MAAM,CAACF,WAAW,IAAI,OAAO,CAAC,IAAIE,MAAM,CAAC,OAAO,CAAC;IAE/D,IAAI,OAAOC,KAAK,KAAK,QAAQ,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;MAC1D,OAAOF,MAAM,CAACE,KAAK,CAAC;AACtB,IAAA;AACF,EAAA;AAEA,EAAA,OAAO,EAAE;AACX;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAGA;MACaC,2BAA2B,GAAGA,CACzCC,IAAY,EACZC,eAAyB,KACbA,eAAe,GAAGD,IAAI,GAAGA,IAAI,CAACE,WAAW;;AAEvD;AACA;AACA;AACA;AACO,MAAMC,eAAe,GAC1BT,MAAe,IAEfU,OAAO,CACLV,MAAM,IACJ,OAAOA,MAAM,KAAK,QAAQ,IAC1BW,KAAK,CAACC,OAAO,CAAEZ,MAAM,CAA2Ba,OAAO,CAC3D;;AAEF;MACaC,kBAAkB,GAAIC,KAGlC,IAAab,MAAM,CAACa,KAAK,CAACC,SAAS,IAAID,KAAK,CAACE,KAAK,IAAI,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-box.ts"],"sourcesContent":["/**\n * Combo box helpers. The group label style port it needs is shared with\n * EuiSelectableList (`utils/eui/selectable.ts`).\n */\nimport type { CSSObject } from '@emotion/css/create-instance';\n\n/**\n * Ember has no React global reset: box sizing for the combo box's own\n * elements (upstream `*` reset) and the list's `button`-free rows.\n */\nexport const comboBoxBoxReset: CSSObject = {\n boxSizing: 'border-box',\n '& :where(*, *::before, *::after)': { boxSizing: 'border-box' }\n};\n\n/** The text of an option: strings as they are, else `label` (or `@searchField`). */\nexport function comboBoxOptionLabel(option: unknown, searchField?: string): string {\n if (typeof option === 'string') return option;\n if (typeof option === 'number') return String(option);\n if (option && typeof option === 'object') {\n const record = option as Record<string, unknown>;\n const value = record[searchField ?? 'label'] ?? record['label'];\n\n if (typeof value === 'string' || typeof value === 'number') {\n return String(value);\n }\n }\n\n return '';\n}\n\n/*\n * Matching helpers below are ported from @elastic/eui 123.1.0\n * `components/combo_box/matching_options.ts` and `combo_box/utils.tsx`.\n * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under\n * one or more contributor license agreements. Licensed under the Elastic\n * License 2.0 or the Server Side Public License, v 1; see vendor/eui-latest.\n */\n\n/** Upstream `SortMatchesBy`. */\nexport type EuiComboBoxSortMatchesBy = 'none' | 'startsWith';\n\n/** Upstream `transformForCaseSensitivity`. */\nexport const transformForCaseSensitivity = (\n text: string,\n isCaseSensitive?: boolean\n): string => (isCaseSensitive ? text : text.toLowerCase());\n\n/**\n * A group: upstream's `{ label, options }` or ember-power-select's\n * `{ groupName, options }`.\n */\nexport const isComboBoxGroup = (\n option: unknown\n): option is { options: unknown[]; groupName?: string; label?: string } =>\n Boolean(\n option &&\n typeof option === 'object' &&\n Array.isArray((option as { options?: unknown }).options)\n );\n\n/** The title of a group (`groupName`, else upstream's `label`). */\nexport const comboBoxGroupLabel = (group: {\n groupName?: string;\n label?: string;\n}): string => String(group.groupName ?? group.label ?? '');\n\n/** Upstream `flattenOptionGroups`: the options of groups, in one list. */\nexport function flattenOptionGroups(options: readonly unknown[]): unknown[] {\n return options.reduce<unknown[]>((all, option) => {\n if (isComboBoxGroup(option)) return all.concat(option.options);\n all.push(option);\n\n return all;\n }, []);\n}\n\n/** Upstream `EuiComboBoxOptionMatcherArgs`. */\nexport interface EuiComboBoxOptionMatcherArgs {\n /** The option being matched. */\n option: any;\n /** The search text, as typed. */\n searchValue: string;\n /** The search text trimmed, and lower case unless case-sensitive. */\n normalizedSearchValue: string;\n /** Whether matching is case-sensitive. */\n isCaseSensitive: boolean;\n}\n\n/** Upstream `EuiComboBoxOptionMatcher`: `true` when the option matches. */\nexport type EuiComboBoxOptionMatcher = (\n args: EuiComboBoxOptionMatcherArgs\n) => boolean;\n\n/**\n * Upstream `createPartialStringEqualityOptionMatcher`: options whose label\n * (trimmed) includes the normalized search text.\n */\nexport function createPartialStringEqualityOptionMatcher(\n searchField?: string,\n ignoreAccents = false\n): EuiComboBoxOptionMatcher {\n const fold = ignoreAccents ? removeAccents : (text: string) => text;\n\n return ({ option, isCaseSensitive, normalizedSearchValue }) => {\n if (!normalizedSearchValue) return true;\n\n return fold(\n transformForCaseSensitivity(\n comboBoxOptionLabel(option, searchField).trim(),\n isCaseSensitive\n )\n ).includes(fold(normalizedSearchValue));\n };\n}\n\n/** \"Médico\" -> \"Medico\": accents (any combining mark) off. */\nconst removeAccents = (text: string): string =>\n text.normalize('NFD').replace(/\\p{M}/gu, '');\n\nconst keyOf = (option: unknown): unknown =>\n option && typeof option === 'object'\n ? (option as { key?: unknown }).key\n : undefined;\n\n/**\n * Upstream's \"already selected\" test of `getMatchingOptions`: a selected\n * option has the same label (case per `isCaseSensitive`) and, when the\n * option has a `key`, the same key. The same object always is.\n */\nexport function isComboBoxOptionSelected(\n option: unknown,\n selectedOptions: readonly unknown[],\n searchField?: string,\n isCaseSensitive?: boolean\n): boolean {\n if (!selectedOptions.length) return false;\n if (selectedOptions.includes(option)) return true;\n\n const label = comboBoxOptionLabel(option, searchField);\n\n if (!label) return false;\n\n const normalized = transformForCaseSensitivity(label, isCaseSensitive);\n const key = keyOf(option);\n\n return selectedOptions.some(\n (selected) =>\n transformForCaseSensitivity(\n comboBoxOptionLabel(selected, searchField),\n isCaseSensitive\n ) === normalized &&\n (key === undefined || keyOf(selected) === key)\n );\n}\n\n/**\n * Upstream single selection check mark: the selected option has the same\n * label and key (or is the same object).\n */\nexport function isComboBoxOptionChecked(\n option: unknown,\n selectedOptions: readonly unknown[] | undefined,\n searchField?: string\n): boolean {\n const selected = selectedOptions?.[0];\n\n if (selected === undefined) return false;\n if (selected === option) return true;\n\n const label = comboBoxOptionLabel(option, searchField);\n\n return (\n Boolean(label) &&\n comboBoxOptionLabel(selected, searchField) === label &&\n keyOf(selected) === keyOf(option)\n );\n}\n\ninterface GetMatchingOptions {\n options: readonly unknown[];\n selectedOptions: readonly unknown[];\n searchValue: string;\n optionMatcher: EuiComboBoxOptionMatcher;\n searchField?: string;\n isCaseSensitive?: boolean;\n isPreFiltered?: boolean;\n showPrevSelected?: boolean;\n sortMatchesBy?: EuiComboBoxSortMatchesBy;\n}\n\n/** A group title in the flat list of matches (upstream `isGroupLabelOption`). */\nexport interface ComboBoxGroupLabel {\n isGroupLabelOption: true;\n group: { options: unknown[]; groupName?: string; label?: string };\n}\n\nexport const isComboBoxGroupLabel = (\n entry: unknown\n): entry is ComboBoxGroupLabel =>\n Boolean(\n entry &&\n typeof entry === 'object' &&\n (entry as ComboBoxGroupLabel).isGroupLabelOption === true &&\n 'group' in entry\n );\n\n/**\n * Upstream `getMatchingOptions`, as a flat list with group titles: the\n * options (not yet selected, unless `showPrevSelected`) matching the search\n * text, groups with matches preceded by their title, and with\n * `sortMatchesBy: 'startsWith'` the entries (titles included) whose label\n * starts with the search text first.\n */\nexport function getMatchingEntries({\n options,\n selectedOptions,\n searchValue,\n optionMatcher,\n searchField,\n isCaseSensitive = false,\n isPreFiltered = false,\n showPrevSelected = false,\n sortMatchesBy = 'none'\n}: GetMatchingOptions): unknown[] {\n const normalizedSearchValue = transformForCaseSensitivity(\n searchValue.trim(),\n isCaseSensitive\n );\n let entries: unknown[] = [];\n\n const collect = (accumulator: unknown[], option: unknown) => {\n // only options not selected yet, unless requested\n if (\n !showPrevSelected &&\n isComboBoxOptionSelected(\n option,\n selectedOptions,\n searchField,\n isCaseSensitive\n )\n ) {\n return;\n }\n\n if (\n isPreFiltered ||\n !normalizedSearchValue ||\n optionMatcher({\n option,\n searchValue,\n normalizedSearchValue,\n isCaseSensitive\n })\n ) {\n accumulator.push(option);\n }\n };\n\n options.forEach((option) => {\n if (isComboBoxGroup(option)) {\n const matches: unknown[] = [];\n\n option.options.forEach((child) => collect(matches, child));\n\n if (matches.length > 0) {\n entries.push({ isGroupLabelOption: true, group: option });\n // concat over spreading, for large groups (upstream)\n entries = entries.concat(matches);\n }\n } else {\n collect(entries, option);\n }\n });\n\n if (sortMatchesBy === 'startsWith') {\n const startWith: unknown[] = [];\n const others: unknown[] = [];\n\n entries.forEach((entry) => {\n const label = isComboBoxGroupLabel(entry)\n ? comboBoxGroupLabel(entry.group)\n : comboBoxOptionLabel(entry, searchField);\n\n (transformForCaseSensitivity(label, isCaseSensitive).startsWith(\n normalizedSearchValue\n )\n ? startWith\n : others\n ).push(entry);\n });\n\n return [...startWith, ...others];\n }\n\n return entries;\n}\n\n/**\n * The flat list of matches as ember-power-select options: every option\n * after a group title belongs to that group (as rendered upstream), the\n * others are top level. Groups are copies with the matching options (and a\n * `groupName`), the options themselves are never copied.\n */\nexport function entriesToPowerSelectOptions(entries: readonly unknown[]) {\n const result: unknown[] = [];\n let current: { options: unknown[]; groupName?: string } | undefined;\n\n entries.forEach((entry) => {\n if (isComboBoxGroupLabel(entry)) {\n current = {\n ...entry.group,\n groupName: comboBoxGroupLabel(entry.group),\n options: []\n };\n result.push(current);\n } else if (current) {\n current.options.push(entry);\n } else {\n result.push(entry);\n }\n });\n\n return result;\n}\n\n/**\n * Groups and their options in one list (group objects included), the rows\n * of EuiComboBox's list and upstream's `matchingOptions` order.\n */\nexport function flattenComboBoxRows(options: readonly unknown[]): unknown[] {\n const rows: unknown[] = [];\n\n options.forEach((option) => {\n if (isComboBoxGroup(option) && 'groupName' in option) {\n rows.push(option);\n option.options.forEach((child) => rows.push(child));\n } else {\n rows.push(option);\n }\n });\n\n return rows;\n}\n\n/** An option that can be highlighted or chosen (not a group, not disabled). */\nexport const isSelectableRow = (row: unknown, group?: unknown): boolean =>\n !(isComboBoxGroup(row) && 'groupName' in (row as object)) &&\n !(\n row &&\n typeof row === 'object' &&\n (row as { disabled?: boolean }).disabled === true\n ) &&\n !(\n group &&\n typeof group === 'object' &&\n (group as { disabled?: boolean }).disabled === true\n );\n\n/**\n * Upstream `findNextSelectableOptionIndex`: from `startIndex`, the first\n * selectable row in `direction`, wrapping around; `-1` when none.\n */\nexport function findNextSelectableIndex(\n rows: readonly unknown[],\n selectable: (index: number) => boolean,\n startIndex: number,\n direction: 1 | -1 = 1\n): number {\n if (!rows.length) return -1;\n\n let index = startIndex;\n\n for (let count = 0; count < rows.length; count++) {\n if (selectable(index)) return index;\n\n index = (index + direction + rows.length) % rows.length;\n }\n\n return -1;\n}\n\n/**\n * Upstream `getSelectedOptionForSearchValue`: the selected option whose\n * label equals the text.\n */\nexport function selectedOptionForSearchValue(\n selectedOptions: readonly unknown[],\n searchValue: string,\n searchField: string | undefined,\n isCaseSensitive?: boolean\n): unknown {\n const search = transformForCaseSensitivity(searchValue, isCaseSensitive);\n\n return selectedOptions.find(\n (option) =>\n transformForCaseSensitivity(\n comboBoxOptionLabel(option, searchField),\n isCaseSensitive\n ) === search\n );\n}\n\n/**\n * Upstream `EuiComboBoxOptionAppendPrepend` spacing: margin between an\n * option's `prepend` / `append` and its text, with block icons so they\n * align with the text.\n */\nexport function comboBoxAppendPrependStyles(\n margin: string\n): { prepend: CSSObject; append: CSSObject } {\n const centerIcons = { '.euiIcon': { display: 'block' } };\n\n return {\n prepend: { marginInlineEnd: margin, ...centerIcons },\n append: { marginInlineStart: margin, ...centerIcons }\n };\n}\n\n/**\n * Option `prepend` / `append` and EuiComboBox's `@prepend` / `@append`:\n * text, or a component (rendered with the option as `@option`).\n */\nexport const isTextNode = (value: unknown): boolean =>\n typeof value === 'string' ||\n typeof value === 'number' ||\n // htmlSafe strings render as HTML, like text\n (Boolean(value) &&\n typeof value === 'object' &&\n typeof (value as { toHTML?: unknown }).toHTML === 'function');\n"],"names":["comboBoxBoxReset","boxSizing","comboBoxOptionLabel","option","searchField","String","record","value","transformForCaseSensitivity","text","isCaseSensitive","toLowerCase","isComboBoxGroup","Boolean","Array","isArray","options","comboBoxGroupLabel","group","groupName","label","flattenOptionGroups","reduce","all","concat","push","createPartialStringEqualityOptionMatcher","ignoreAccents","fold","removeAccents","normalizedSearchValue","trim","includes","normalize","replace","keyOf","key","undefined","isComboBoxOptionSelected","selectedOptions","length","normalized","some","selected","isComboBoxOptionChecked","isComboBoxGroupLabel","entry","isGroupLabelOption","getMatchingEntries","searchValue","optionMatcher","isPreFiltered","showPrevSelected","sortMatchesBy","entries","collect","accumulator","forEach","matches","child","startWith","others","startsWith","entriesToPowerSelectOptions","result","current","flattenComboBoxRows","rows","isSelectableRow","row","disabled","findNextSelectableIndex","selectable","startIndex","direction","index","count","selectedOptionForSearchValue","search","find","comboBoxAppendPrependStyles","margin","centerIcons","display","prepend","marginInlineEnd","append","marginInlineStart","isTextNode","toHTML"],"mappings":"AAAA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACO,MAAMA,gBAA2B,GAAG;AACzCC,EAAAA,SAAS,EAAE,YAAY;AACvB,EAAA,kCAAkC,EAAE;AAAEA,IAAAA,SAAS,EAAE;AAAa;AAChE;;AAEA;AACO,SAASC,mBAAmBA,CAACC,MAAe,EAAEC,WAAoB,EAAU;AACjF,EAAA,IAAI,OAAOD,MAAM,KAAK,QAAQ,EAAE,OAAOA,MAAM;EAC7C,IAAI,OAAOA,MAAM,KAAK,QAAQ,EAAE,OAAOE,MAAM,CAACF,MAAM,CAAC;AACrD,EA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AAC3B,MAAM,IAAI2B,IAAI,CAAC3B,MAAM;AACzD,EAAA;AAEA,EAAA,OAAO,EAAE;AACX;;AAEA;AACA;AACA;AACA;AACO,SAASqC,4BAA4BA,CAC1CtC,eAAmC,EACnCU,WAAmB,EACnB7C,WAA+B,EAC/BM,eAAyB,EAChB;AACT,EAAA,MAAMoE,MAAM,GAAGtE,2BAA2B,CAACyC,WAAW,EAAEvC,eAAe,CAAC;AAExE,EAAA,OAAO6B,eAAe,CAACwC,IAAI,CACxB5E,MAAM,IACLK,2BAA2B,CACzBN,mBAAmB,CAACC,MAAM,EAAEC,WAAW,CAAC,EACxCM,eACF,CAAC,KAAKoE,MACV,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASE,2BAA2BA,CACzCC,MAAc,EAC6B;AAC3C,EAAA,MAAMC,WAAW,GAAG;AAAE,IAAA,UAAU,EAAE;AAAEC,MAAAA,OAAO,EAAE;AAAQ;GAAG;EAExD,OAAO;AACLC,IAAAA,OAAO,EAAE;AAAEC,MAAAA,eAAe,EAAEJ,MAAM;MAAE,GAAGC;KAAa;AACpDI,IAAAA,MAAM,EAAE;AAAEC,MAAAA,iBAAiB,EAAEN,MAAM;MAAE,GAAGC;AAAY;GACrD;AACH;;AAEA;AACA;AACA;AACA;AACO,MAAMM,UAAU,GAAIjF,KAAc,IACvC,OAAOA,KAAK,KAAK,QAAQ,IACzB,OAAOA,KAAK,KAAK,QAAQ;AACzB;AACCM,OAAO,CAACN,KAAK,CAAC,IACb,OAAOA,KAAK,KAAK,QAAQ,IACzB,OAAQA,KAAK,CAA0BkF,MAAM,KAAK;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ember-eui/core",
3
- "version": "16.0.2",
3
+ "version": "16.0.3",
4
4
  "description": "Ember Components for Elastic UI",
5
5
  "keywords": [
6
6
  "ember-addon",