{"version":3,"sources":["../src/table/table.tsx"],"sourcesContent":["import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { forwardRef, useId } from \"react\";\n\ninterface TableProps extends React.HTMLAttributes<HTMLTableElement> {\n  className?: string;\n\n  /**\n   * Size of the table\n   *\n   * Use `compressed` for a more compact table, or `mobile-compressed` for a compact table on mobile screens only.\n   */\n  size?: \"default\" | \"compressed\" | \"mobile-compressed\";\n\n  /**\n   * The table caption\n   *\n   * You can also set this by passing `<caption>` as a first child of the table\n   */\n  caption?: React.ReactNode;\n\n  /**\n   * Optional description of the table displayed underneath the table\n   *\n   * Ensures the `aria-describedby` attribute is set on the table, making it accessible for screen readers.\n   */\n  description?: React.ReactNode;\n}\n\nexport const Table = forwardRef<HTMLTableElement, TableProps>(\n  ({ children, className, size, caption, description, ...rest }, ref) => {\n    const descriptionId = useId();\n    return (\n      <>\n        <table\n          aria-describedby={description ? descriptionId : undefined}\n          ref={ref}\n          className={clsx(\n            \"hds-table\",\n            {\n              \"hds-table--compressed\": size === \"compressed\",\n              \"hds-table--mobile-compressed\": size === \"mobile-compressed\",\n            },\n            className as undefined,\n          )}\n          {...rest}\n        >\n          {caption ? <caption>{caption}</caption> : null}\n          {children}\n        </table>\n        {description ? (\n          <p className={clsx(\"hds-table-description\")} id={descriptionId}>\n            {description}\n          </p>\n        ) : null}\n      </>\n    );\n  },\n);\nTable.displayName = \"Table\";\n"],"mappings":";;;;;;;AAAA,SAAS,YAAY;AACrB,SAAS,YAAY,aAAa;AA+B5B,mBAce,KAbb,YADF;AAJC,IAAM,QAAQ;AAAA,EACnB,CAAC,IAA8D,QAAQ;AAAtE,iBAAE,YAAU,WAAW,MAAM,SAAS,YA7BzC,IA6BG,IAAsD,iBAAtD,IAAsD,CAApD,YAAU,aAAW,QAAM,WAAS;AACrC,UAAM,gBAAgB,MAAM;AAC5B,WACE,iCACE;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,oBAAkB,cAAc,gBAAgB;AAAA,UAChD;AAAA,UACA,WAAW;AAAA,YACT;AAAA,YACA;AAAA,cACE,yBAAyB,SAAS;AAAA,cAClC,gCAAgC,SAAS;AAAA,YAC3C;AAAA,YACA;AAAA,UACF;AAAA,WACI,OAXL;AAAA,UAaE;AAAA,sBAAU,oBAAC,aAAS,mBAAQ,IAAa;AAAA,YACzC;AAAA;AAAA;AAAA,MACH;AAAA,MACC,cACC,oBAAC,OAAE,WAAW,KAAK,uBAAuB,GAAG,IAAI,eAC9C,uBACH,IACE;AAAA,OACN;AAAA,EAEJ;AACF;AACA,MAAM,cAAc;","names":[]}