{"version":3,"sources":["../src/utils/toDataAttributeValue.ts"],"sourcesContent":["/**\n * Converts a value to the representation used by headless `data-*` state attributes.\n *\n * Boolean values and their string equivalents are represented by the presence or absence of the attribute:\n * - `true` and `'true'` become an empty string, indicating that the attribute is present.\n * - `false`, `'false'`, and `undefined` become `undefined`, indicating that the attribute is omitted.\n * - Other string and number values are converted to strings.\n *\n * @example\n * ```ts\n * toDataAttributeValue(true); // ''\n * toDataAttributeValue(false); // undefined\n * toDataAttributeValue('mixed'); // 'mixed'\n * toDataAttributeValue(0); // '0'\n * ```\n */\nexport function toDataAttributeValue(value: boolean | string | number | undefined): string | undefined {\n  if (value === true || value === 'true') {\n    return '';\n  }\n\n  if (value === false || value === 'false' || value === undefined) {\n    return undefined;\n  }\n\n  return String(value);\n}\n"],"names":["toDataAttributeValue","value","undefined","String"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC;;;;+BACeA;;;eAAAA;;;AAAT,SAASA,qBAAqBC,KAA4C;IAC/E,IAAIA,UAAU,QAAQA,UAAU,QAAQ;QACtC,OAAO;IACT;IAEA,IAAIA,UAAU,SAASA,UAAU,WAAWA,UAAUC,WAAW;QAC/D,OAAOA;IACT;IAEA,OAAOC,OAAOF;AAChB"}