@bazza-ui/react 0.1.0-canary.10 → 0.1.0-canary.12

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 (37) hide show
  1. package/dist/chunk-5T5B5SPR.cjs.map +1 -1
  2. package/dist/{chunk-BFOY762U.js → chunk-65TSJ7MA.js} +2 -2
  3. package/dist/{chunk-BFOY762U.js.map → chunk-65TSJ7MA.js.map} +1 -1
  4. package/dist/{chunk-W4ACKMIZ.cjs → chunk-EYMK7XHC.cjs} +2 -2
  5. package/dist/chunk-EYMK7XHC.cjs.map +1 -0
  6. package/dist/chunk-JFEVUUPC.cjs.map +1 -1
  7. package/dist/chunk-M4G6J7DP.cjs.map +1 -1
  8. package/dist/chunk-SCDHQZFI.cjs.map +1 -1
  9. package/dist/chunk-XMZZ62VJ.cjs.map +1 -1
  10. package/dist/combobox/index.cjs +1 -1
  11. package/dist/combobox/index.cjs.map +1 -1
  12. package/dist/combobox/index.js +1 -1
  13. package/dist/command-menu/index.cjs +1 -1
  14. package/dist/command-menu/index.cjs.map +1 -1
  15. package/dist/command-menu/index.js +1 -1
  16. package/dist/context-menu/index.cjs +1 -1
  17. package/dist/context-menu/index.cjs.map +1 -1
  18. package/dist/context-menu/index.js +1 -1
  19. package/dist/dropdown-menu/index.cjs +1 -1
  20. package/dist/dropdown-menu/index.cjs.map +1 -1
  21. package/dist/dropdown-menu/index.js +1 -1
  22. package/dist/dropdown-menu/index.js.map +1 -1
  23. package/dist/internal/listbox/index.cjs.map +1 -1
  24. package/dist/internal/popup-menu/index.cjs +1 -1
  25. package/dist/internal/popup-menu/index.cjs.map +1 -1
  26. package/dist/internal/popup-menu/index.js +1 -1
  27. package/dist/kbd/index.cjs.map +1 -1
  28. package/dist/loaders/index.cjs.map +1 -1
  29. package/dist/select/index.cjs +1 -1
  30. package/dist/select/index.cjs.map +1 -1
  31. package/dist/select/index.d.cts +22 -2
  32. package/dist/select/index.d.ts +22 -2
  33. package/dist/select/index.js +1 -1
  34. package/dist/select/index.js.map +1 -1
  35. package/dist/video-player/index.cjs.map +1 -1
  36. package/package.json +1 -1
  37. package/dist/chunk-W4ACKMIZ.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utils/item-equality.ts","../src/utils/items.ts"],"names":["defaultItemEquality","item","value","compareItemEquality","comparer","itemIncludes","collection","removeItem","entryKey","resolveItemFromItems","items","valueKey","entry","i","label","resolveLabelFromItems","mergeKeywords","keywords","extra","additions","k","merged","keyword"],"mappings":"AAaO,qrBAAMA,CAAAA,CAA4C,CAACC,CAAAA,CAAMC,CAAAA,CAAAA,EAC9D,MAAA,CAAO,EAAA,CAAGD,CAAAA,CAAMC,CAAK,CAAA,CAMhB,SAASC,CAAAA,CACdF,CAAAA,CACAC,CAAAA,CACAE,CAAAA,CACS,CAET,OAAIH,CAAAA,EAAQ,IAAA,EAAQC,CAAAA,EAAS,IAAA,CACpB,MAAA,CAAO,EAAA,CAAGD,CAAAA,CAAMC,CAAK,CAAA,CAEvBE,CAAAA,CAASH,CAAAA,CAAMC,CAAK,CAC7B,CAKO,SAASG,CAAAA,CACdC,CAAAA,CACAJ,CAAAA,CACAE,CAAAA,CACS,CACT,MAAI,CAACE,CAAAA,EAAcA,CAAAA,CAAW,MAAA,GAAW,CAAA,CAChC,CAAA,CAAA,CAEFA,CAAAA,CAAW,IAAA,CAAML,CAAAA,EAClBA,CAAAA,GAAS,KAAA,CAAA,CACJ,CAAA,CAAA,CAEFE,CAAAA,CAAoBF,CAAAA,CAAMC,CAAAA,CAAOE,CAAQ,CACjD,CACH,CA0BO,SAASG,CAAAA,CACdD,CAAAA,CACAJ,CAAAA,CACAE,CAAAA,CACS,CACT,OAAOE,CAAAA,CAAW,MAAA,CACfL,CAAAA,EAAS,CAACE,CAAAA,CAAoBF,CAAAA,CAAMC,CAAAA,CAAOE,CAAQ,CACtD,CACF,CC3CA,SAASI,CAAAA,CAASN,CAAAA,CAA8B,CAC9C,wBAAO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PR.cjs","sourcesContent":["/**\n * Type for custom item equality comparison functions.\n * Used to compare object values in Select and Combobox components.\n */\nexport type ItemEqualityComparer<Value = unknown> = (\n itemValue: Value,\n value: Value,\n) => boolean\n\n/**\n * Default equality comparer using Object.is.\n * Handles primitives and object reference equality.\n */\nexport const defaultItemEquality: ItemEqualityComparer = (item, value) =>\n Object.is(item, value)\n\n/**\n * Compare two items for equality using a custom comparer.\n * Handles null/undefined values separately using Object.is.\n */\nexport function compareItemEquality<Value>(\n item: Value | null | undefined,\n value: Value | null | undefined,\n comparer: ItemEqualityComparer<Value>,\n): boolean {\n // Handle null/undefined with Object.is for consistent behavior\n if (item == null || value == null) {\n return Object.is(item, value)\n }\n return comparer(item, value)\n}\n\n/**\n * Check if a collection includes a specific value using custom equality.\n */\nexport function itemIncludes<Value>(\n collection: readonly Value[] | undefined | null,\n value: Value | null | undefined,\n comparer: ItemEqualityComparer<Value>,\n): boolean {\n if (!collection || collection.length === 0) {\n return false\n }\n return collection.some((item) => {\n if (item === undefined) {\n return false\n }\n return compareItemEquality(item, value, comparer)\n })\n}\n\n/**\n * Find the index of a value in a collection using custom equality.\n * Returns -1 if not found.\n */\nexport function findItemIndex<Value>(\n collection: readonly Value[] | undefined | null,\n value: Value,\n comparer: ItemEqualityComparer<Value>,\n): number {\n if (!collection || collection.length === 0) {\n return -1\n }\n return collection.findIndex((item) => {\n if (item === undefined) {\n return false\n }\n return compareItemEquality(item, value, comparer)\n })\n}\n\n/**\n * Remove a value from a collection using custom equality.\n * Returns a new array without the matching item.\n */\nexport function removeItem<Value>(\n collection: readonly Value[],\n value: Value,\n comparer: ItemEqualityComparer<Value>,\n): Value[] {\n return collection.filter(\n (item) => !compareItemEquality(item, value, comparer),\n )\n}\n","import type * as React from 'react'\n\n/**\n * A single entry in the array form of the `items` prop passed to\n * `Select.Root` / `Combobox.Root`.\n */\nexport interface ItemsEntry {\n /**\n * The item's value.\n *\n * Use `null` to describe a clearable/placeholder item (its label is used as\n * the trigger placeholder and selecting it clears the value).\n */\n value: string | null\n /** The label to display for this item. */\n label: React.ReactNode\n /**\n * Additional keywords to match against when filtering, on top of the label.\n * Useful for aliases or synonyms.\n */\n keywords?: string[]\n}\n\n/**\n * Data structure describing the items rendered in a Select/Combobox popup.\n *\n * Either a record mapping a value to its label, or an array of entries. Only\n * the array form can express `keywords` or a `null` (clearable) value.\n */\nexport type Items = Record<string, React.ReactNode> | Array<ItemsEntry>\n\n/**\n * The resolved metadata for a single item looked up from the `items` prop.\n */\nexport interface ResolvedItem {\n label: React.ReactNode\n keywords?: string[]\n}\n\n/** Serialize an entry value to the string key used for registry lookups. */\nfunction entryKey(value: string | null): string {\n return value == null ? '' : value\n}\n\n/**\n * Resolve the full entry (label + keywords) from the `items` prop for a given\n * serialized value key. Returns `undefined` when there is no match.\n */\nexport function resolveItemFromItems(\n items: Items | undefined,\n valueKey: string,\n): ResolvedItem | undefined {\n if (!items) return undefined\n\n if (Array.isArray(items)) {\n const entry = items.find((i) => entryKey(i.value) === valueKey)\n if (!entry) return undefined\n return { label: entry.label, keywords: entry.keywords }\n }\n\n const label = items[valueKey]\n if (label === undefined) return undefined\n return { label }\n}\n\n/**\n * Resolve just the label from the `items` prop for a given serialized value\n * key. Returns `undefined` when there is no match.\n */\nexport function resolveLabelFromItems(\n items: Items | undefined,\n valueKey: string,\n): React.ReactNode | undefined {\n return resolveItemFromItems(items, valueKey)?.label\n}\n\n/**\n * Merge a set of extra keyword strings into an existing keywords array,\n * preserving order and removing duplicates. Returns the original `keywords`\n * reference untouched when there is nothing to add.\n */\nexport function mergeKeywords(\n keywords: string[] | undefined,\n extra: Array<string | undefined>,\n): string[] | undefined {\n const additions = extra.filter((k): k is string => Boolean(k))\n if (additions.length === 0) return keywords\n\n const merged = keywords ? [...keywords] : []\n for (const keyword of additions) {\n if (!merged.includes(keyword)) merged.push(keyword)\n }\n return merged\n}\n"]}
1
+ {"version":3,"sources":["../src/utils/item-equality.ts","../src/utils/items.ts"],"names":["defaultItemEquality","item","value","compareItemEquality","comparer","itemIncludes","collection","removeItem","entryKey","resolveItemFromItems","items","valueKey","entry","i","label","resolveLabelFromItems","mergeKeywords","keywords","extra","additions","k","merged","keyword"],"mappings":"AAaO,qrBAAMA,CAAAA,CAA4C,CAACC,CAAAA,CAAMC,CAAAA,CAAAA,EAC9D,MAAA,CAAO,EAAA,CAAGD,CAAAA,CAAMC,CAAK,CAAA,CAMhB,SAASC,CAAAA,CACdF,CAAAA,CACAC,CAAAA,CACAE,CAAAA,CACS,CAET,OAAIH,CAAAA,EAAQ,IAAA,EAAQC,CAAAA,EAAS,IAAA,CACpB,MAAA,CAAO,EAAA,CAAGD,CAAAA,CAAMC,CAAK,CAAA,CAEvBE,CAAAA,CAASH,CAAAA,CAAMC,CAAK,CAC7B,CAKO,SAASG,CAAAA,CACdC,CAAAA,CACAJ,CAAAA,CACAE,CAAAA,CACS,CACT,MAAI,CAACE,CAAAA,EAAcA,CAAAA,CAAW,MAAA,GAAW,CAAA,CAChC,CAAA,CAAA,CAEFA,CAAAA,CAAW,IAAA,CAAML,CAAAA,EAClBA,CAAAA,GAAS,KAAA,CAAA,CACJ,CAAA,CAAA,CAEFE,CAAAA,CAAoBF,CAAAA,CAAMC,CAAAA,CAAOE,CAAQ,CACjD,CACH,CA0BO,SAASG,CAAAA,CACdD,CAAAA,CACAJ,CAAAA,CACAE,CAAAA,CACS,CACT,OAAOE,CAAAA,CAAW,MAAA,CACfL,CAAAA,EAAS,CAACE,CAAAA,CAAoBF,CAAAA,CAAMC,CAAAA,CAAOE,CAAQ,CACtD,CACF,CC3CA,SAASI,CAAAA,CAASN,CAAAA,CAA8B,CAC9C,wBAAOA,CAAAA,SAAgB,IACzB,CAMO,SAASO,CAAAA,CACdC,CAAAA,CACAC,CAAAA,CAC0B,CAC1B,EAAA,CAAI,CAACD,CAAAA,CAAO,MAAA,CAEZ,EAAA,CAAI,KAAA,CAAM,OAAA,CAAQA,CAAK,CAAA,CAAG,CACxB,IAAME,CAAAA,CAAQF,CAAAA,CAAM,IAAA,CAAMG,CAAAA,EAAML,CAAAA,CAASK,CAAAA,CAAE,KAAK,CAAA,GAAMF,CAAQ,CAAA,CAC9D,OAAKC,CAAAA,CACE,CAAE,KAAA,CAAOA,CAAAA,CAAM,KAAA,CAAO,QAAA,CAAUA,CAAAA,CAAM,QAAS,CAAA,CAD1C,KAAA,CAEd,CAEA,IAAME,CAAAA,CAAQJ,CAAAA,CAAMC,CAAQ,CAAA,CAC5B,EAAA,CAAIG,CAAAA,GAAU,KAAA,CAAA,CACd,MAAO,CAAE,KAAA,CAAAA,CAAM,CACjB,CAMO,SAASC,CAAAA,CACdL,CAAAA,CACAC,CAAAA,CAC6B,CAC7B,uBAAOF,CAAAA,iBAAqBC,CAAAA,CAAOC,CAAQ,CAAA,6BAAG,OAChD,CAOO,SAASK,CAAAA,CACdC,CAAAA,CACAC,CAAAA,CACsB,CACtB,IAAMC,CAAAA,CAAYD,CAAAA,CAAM,MAAA,CAAQE,CAAAA,EAAmB,CAAA,CAAQA,CAAE,CAAA,CAC7D,EAAA,CAAID,CAAAA,CAAU,MAAA,GAAW,CAAA,CAAG,OAAOF,CAAAA,CAEnC,IAAMI,CAAAA,CAASJ,CAAAA,CAAW,CAAC,GAAGA,CAAQ,CAAA,CAAI,CAAC,CAAA,CAC3C,GAAA,CAAA,IAAWK,EAAAA,GAAWH,CAAAA,CACfE,CAAAA,CAAO,QAAA,CAASC,CAAO,CAAA,EAAGD,CAAAA,CAAO,IAAA,CAAKC,CAAO,CAAA,CAEpD,OAAOD,CACT,CAAA,wGAAA","file":"/home/runner/work/ui/ui/packages/react/dist/chunk-5T5B5SPR.cjs","sourcesContent":["/**\n * Type for custom item equality comparison functions.\n * Used to compare object values in Select and Combobox components.\n */\nexport type ItemEqualityComparer<Value = unknown> = (\n itemValue: Value,\n value: Value,\n) => boolean\n\n/**\n * Default equality comparer using Object.is.\n * Handles primitives and object reference equality.\n */\nexport const defaultItemEquality: ItemEqualityComparer = (item, value) =>\n Object.is(item, value)\n\n/**\n * Compare two items for equality using a custom comparer.\n * Handles null/undefined values separately using Object.is.\n */\nexport function compareItemEquality<Value>(\n item: Value | null | undefined,\n value: Value | null | undefined,\n comparer: ItemEqualityComparer<Value>,\n): boolean {\n // Handle null/undefined with Object.is for consistent behavior\n if (item == null || value == null) {\n return Object.is(item, value)\n }\n return comparer(item, value)\n}\n\n/**\n * Check if a collection includes a specific value using custom equality.\n */\nexport function itemIncludes<Value>(\n collection: readonly Value[] | undefined | null,\n value: Value | null | undefined,\n comparer: ItemEqualityComparer<Value>,\n): boolean {\n if (!collection || collection.length === 0) {\n return false\n }\n return collection.some((item) => {\n if (item === undefined) {\n return false\n }\n return compareItemEquality(item, value, comparer)\n })\n}\n\n/**\n * Find the index of a value in a collection using custom equality.\n * Returns -1 if not found.\n */\nexport function findItemIndex<Value>(\n collection: readonly Value[] | undefined | null,\n value: Value,\n comparer: ItemEqualityComparer<Value>,\n): number {\n if (!collection || collection.length === 0) {\n return -1\n }\n return collection.findIndex((item) => {\n if (item === undefined) {\n return false\n }\n return compareItemEquality(item, value, comparer)\n })\n}\n\n/**\n * Remove a value from a collection using custom equality.\n * Returns a new array without the matching item.\n */\nexport function removeItem<Value>(\n collection: readonly Value[],\n value: Value,\n comparer: ItemEqualityComparer<Value>,\n): Value[] {\n return collection.filter(\n (item) => !compareItemEquality(item, value, comparer),\n )\n}\n","import type * as React from 'react'\n\n/**\n * A single entry in the array form of the `items` prop passed to\n * `Select.Root` / `Combobox.Root`.\n */\nexport interface ItemsEntry {\n /**\n * The item's value.\n *\n * Use `null` to describe a clearable/placeholder item (its label is used as\n * the trigger placeholder and selecting it clears the value).\n */\n value: string | null\n /** The label to display for this item. */\n label: React.ReactNode\n /**\n * Additional keywords to match against when filtering, on top of the label.\n * Useful for aliases or synonyms.\n */\n keywords?: string[]\n}\n\n/**\n * Data structure describing the items rendered in a Select/Combobox popup.\n *\n * Either a record mapping a value to its label, or an array of entries. Only\n * the array form can express `keywords` or a `null` (clearable) value.\n */\nexport type Items = Record<string, React.ReactNode> | Array<ItemsEntry>\n\n/**\n * The resolved metadata for a single item looked up from the `items` prop.\n */\nexport interface ResolvedItem {\n label: React.ReactNode\n keywords?: string[]\n}\n\n/** Serialize an entry value to the string key used for registry lookups. */\nfunction entryKey(value: string | null): string {\n return value == null ? '' : value\n}\n\n/**\n * Resolve the full entry (label + keywords) from the `items` prop for a given\n * serialized value key. Returns `undefined` when there is no match.\n */\nexport function resolveItemFromItems(\n items: Items | undefined,\n valueKey: string,\n): ResolvedItem | undefined {\n if (!items) return undefined\n\n if (Array.isArray(items)) {\n const entry = items.find((i) => entryKey(i.value) === valueKey)\n if (!entry) return undefined\n return { label: entry.label, keywords: entry.keywords }\n }\n\n const label = items[valueKey]\n if (label === undefined) return undefined\n return { label }\n}\n\n/**\n * Resolve just the label from the `items` prop for a given serialized value\n * key. Returns `undefined` when there is no match.\n */\nexport function resolveLabelFromItems(\n items: Items | undefined,\n valueKey: string,\n): React.ReactNode | undefined {\n return resolveItemFromItems(items, valueKey)?.label\n}\n\n/**\n * Merge a set of extra keyword strings into an existing keywords array,\n * preserving order and removing duplicates. Returns the original `keywords`\n * reference untouched when there is nothing to add.\n */\nexport function mergeKeywords(\n keywords: string[] | undefined,\n extra: Array<string | undefined>,\n): string[] | undefined {\n const additions = extra.filter((k): k is string => Boolean(k))\n if (additions.length === 0) return keywords\n\n const merged = keywords ? [...keywords] : []\n for (const keyword of additions) {\n if (!merged.includes(keyword)) merged.push(keyword)\n }\n return merged\n}\n"]}