@logicplanes/kaeso-ui 0.4.6 → 0.4.8
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/NOTICE.md +1 -1
- package/ai/component-guides.md +36 -2
- package/ai/component-registry.json +67 -5
- package/ai/component-registry.md +23 -5
- package/ai/icons.md +1 -1
- package/ai/tokens.md +1 -1
- package/dist/blocks/delete-resource.js +1 -1
- package/dist/blocks/pages.js +2 -2
- package/dist/blocks/resource-list.js +3 -3
- package/dist/chunks/{app-frame-DysOel2X.js → app-frame-D8sGcD0v.js} +6 -6
- package/dist/chunks/{app-frame-DysOel2X.js.map → app-frame-D8sGcD0v.js.map} +1 -1
- package/dist/chunks/{banner-B3DGLTBu.js → banner-BinTH032.js} +2 -2
- package/dist/chunks/{banner-B3DGLTBu.js.map → banner-BinTH032.js.map} +1 -1
- package/dist/chunks/{button-IblhXUyZ.js → button-DrmFgdIi.js} +2 -2
- package/dist/chunks/button-DrmFgdIi.js.map +1 -0
- package/dist/chunks/{checkbox-9tbimmF3.js → checkbox-ahl1SOqU.js} +2 -2
- package/dist/chunks/{checkbox-9tbimmF3.js.map → checkbox-ahl1SOqU.js.map} +1 -1
- package/dist/chunks/{code-block-KIvuE8jg.js → code-block-CE3H3nMu.js} +3 -3
- package/dist/chunks/{code-block-KIvuE8jg.js.map → code-block-CE3H3nMu.js.map} +1 -1
- package/dist/chunks/{code-block-64e-Cy1S.js → code-block-O_EPmMIQ.js} +2 -2
- package/dist/chunks/{code-block-64e-Cy1S.js.map → code-block-O_EPmMIQ.js.map} +1 -1
- package/dist/chunks/{combobox-DkcjkWc6.js → combobox-DghYPLVQ.js} +7 -3
- package/dist/chunks/combobox-DghYPLVQ.js.map +1 -0
- package/dist/chunks/{command-list-CypqsC4T.js → command-list-BUmEaaBi.js} +3 -3
- package/dist/chunks/{command-list-CypqsC4T.js.map → command-list-BUmEaaBi.js.map} +1 -1
- package/dist/chunks/{copy-button-CwU8t_9_.js → copy-button-DBPAA1g0.js} +2 -2
- package/dist/chunks/{copy-button-CwU8t_9_.js.map → copy-button-DBPAA1g0.js.map} +1 -1
- package/dist/chunks/{core-CmK-8ObW.js → core-Cw3pNRp3.js} +10 -9
- package/dist/chunks/core-Cw3pNRp3.js.map +1 -0
- package/dist/chunks/data-table-CGecI-FI.js +602 -0
- package/dist/chunks/data-table-CGecI-FI.js.map +1 -0
- package/dist/chunks/{date-popup-DAnjptFt.js → date-popup-C6vVOOWF.js} +2 -2
- package/dist/chunks/{date-popup-DAnjptFt.js.map → date-popup-C6vVOOWF.js.map} +1 -1
- package/dist/chunks/{dialog-2zb6ClNR.js → dialog-s3_LUPBi.js} +4 -4
- package/dist/chunks/{dialog-2zb6ClNR.js.map → dialog-s3_LUPBi.js.map} +1 -1
- package/dist/chunks/{domain-obd_w9xk.js → domain-CrQX3p6E.js} +2 -2
- package/dist/chunks/{domain-obd_w9xk.js.map → domain-CrQX3p6E.js.map} +1 -1
- package/dist/chunks/{icon-button-Dfwpvmav.js → icon-button-6kOn2zrP.js} +2 -2
- package/dist/chunks/{icon-button-Dfwpvmav.js.map → icon-button-6kOn2zrP.js.map} +1 -1
- package/dist/chunks/identity-BwYixi8Q.js +520 -0
- package/dist/chunks/identity-BwYixi8Q.js.map +1 -0
- package/dist/chunks/{input-Bo5-UZg2.js → input-D1SeLe3X.js} +2 -2
- package/dist/chunks/{input-Bo5-UZg2.js.map → input-D1SeLe3X.js.map} +1 -1
- package/dist/chunks/{input-group-jPcK9T_a.js → input-group-BbxwEAUP.js} +2 -2
- package/dist/chunks/{input-group-jPcK9T_a.js.map → input-group-BbxwEAUP.js.map} +1 -1
- package/dist/chunks/{iso-field-DoqHBg8n.js → iso-field-BVOKAY4H.js} +2 -2
- package/dist/chunks/{iso-field-DoqHBg8n.js.map → iso-field-BVOKAY4H.js.map} +1 -1
- package/dist/chunks/{list-B4G-sWwV.js → list-o8wcuBOz.js} +117 -94
- package/dist/chunks/list-o8wcuBOz.js.map +1 -0
- package/dist/chunks/{markdown-C565aBR7.js → markdown-BZKZi9d8.js} +4 -4
- package/dist/chunks/{markdown-C565aBR7.js.map → markdown-BZKZi9d8.js.map} +1 -1
- package/dist/chunks/{menu-Clvv6ftq.js → menu-BDce2kiw.js} +2 -2
- package/dist/chunks/{menu-Clvv6ftq.js.map → menu-BDce2kiw.js.map} +1 -1
- package/dist/chunks/{nav-sheet-Dt6JSvzX.js → nav-sheet-D3U7MeaI.js} +3 -3
- package/dist/chunks/{nav-sheet-Dt6JSvzX.js.map → nav-sheet-D3U7MeaI.js.map} +1 -1
- package/dist/chunks/{page-header-kS5tdmvb.js → page-header-C5Bv1gKE.js} +2 -2
- package/dist/chunks/{page-header-kS5tdmvb.js.map → page-header-C5Bv1gKE.js.map} +1 -1
- package/dist/chunks/{pagination-D7fAm8qg.js → pagination-D9hM6W2z.js} +3 -3
- package/dist/chunks/{pagination-D7fAm8qg.js.map → pagination-D9hM6W2z.js.map} +1 -1
- package/dist/chunks/{picker-popover-1FHb1LQG.js → picker-popover-PzVOo62-.js} +4 -4
- package/dist/chunks/{picker-popover-1FHb1LQG.js.map → picker-popover-PzVOo62-.js.map} +1 -1
- package/dist/chunks/{range-popup-lGiZsG3s.js → range-popup-Dt6Q0Ryw.js} +3 -3
- package/dist/chunks/{range-popup-lGiZsG3s.js.map → range-popup-Dt6Q0Ryw.js.map} +1 -1
- package/dist/chunks/{rights-B68ocZuq.js → rights-DAHTG_kH.js} +4 -4
- package/dist/chunks/{rights-B68ocZuq.js.map → rights-DAHTG_kH.js.map} +1 -1
- package/dist/chunks/{select-BqjmQOqx.js → select-UTdHKubp.js} +2 -2
- package/dist/chunks/{select-BqjmQOqx.js.map → select-UTdHKubp.js.map} +1 -1
- package/dist/chunks/{sidebar-Dq7oGOje.js → sidebar-K30Ae8N5.js} +2 -2
- package/dist/chunks/{sidebar-Dq7oGOje.js.map → sidebar-K30Ae8N5.js.map} +1 -1
- package/dist/chunks/{sidebar-menu-QSSNu1jJ.js → sidebar-menu-C0qJsQF5.js} +2 -2
- package/dist/chunks/{sidebar-menu-QSSNu1jJ.js.map → sidebar-menu-C0qJsQF5.js.map} +1 -1
- package/dist/chunks/styles-8fn_bHRP.js +21 -0
- package/dist/chunks/styles-8fn_bHRP.js.map +1 -0
- package/dist/chunks/{textarea-CO0HP6fK.js → textarea-CRmvC4jd.js} +3 -3
- package/dist/chunks/{textarea-CO0HP6fK.js.map → textarea-CRmvC4jd.js.map} +1 -1
- package/dist/chunks/{theme-provider-DJhORMlc.js → theme-provider-BjXTggqM.js} +6 -2
- package/dist/chunks/theme-provider-BjXTggqM.js.map +1 -0
- package/dist/chunks/{timeseries-Ck-q0wWn.js → timeseries-CK86u7M0.js} +3 -3
- package/dist/chunks/{timeseries-Ck-q0wWn.js.map → timeseries-CK86u7M0.js.map} +1 -1
- package/dist/components/app-frame.js +2 -2
- package/dist/components/banner.js +1 -1
- package/dist/components/button-group.js +1 -1
- package/dist/components/button.js +1 -1
- package/dist/components/charts/bar.js +2 -2
- package/dist/components/charts/donut.js +1 -1
- package/dist/components/charts/gauge.js +1 -1
- package/dist/components/charts/heatmap.js +1 -1
- package/dist/components/charts/sankey.js +2 -2
- package/dist/components/charts/timeseries.js +1 -1
- package/dist/components/charts.js +2 -2
- package/dist/components/checkbox.js +1 -1
- package/dist/components/code-block.js +2 -2
- package/dist/components/combobox.js +1 -1
- package/dist/components/command-list.js +2 -2
- package/dist/components/command-palette.js +1 -1
- package/dist/components/copy-button.js +1 -1
- package/dist/components/data-table.js +1 -1
- package/dist/components/date-picker.js +2 -2
- package/dist/components/dialog.js +2 -2
- package/dist/components/display-options.js +2 -2
- package/dist/components/filter-chip.js +3 -3
- package/dist/components/filter-toggle.js +35 -0
- package/dist/components/filter-toggle.js.map +1 -0
- package/dist/components/icon-button.js +1 -1
- package/dist/components/input.js +3 -3
- package/dist/components/kaeso/conversation.js +2 -2
- package/dist/components/kaeso/identity.js +1 -1
- package/dist/components/kaeso/moments.js +3 -3
- package/dist/components/kaeso/rights.js +1 -1
- package/dist/components/kaeso/usage.js +1 -1
- package/dist/components/kaeso.js +11 -16
- package/dist/components/kaeso.js.map +1 -1
- package/dist/components/key-value.js +1 -1
- package/dist/components/list.js +1 -1
- package/dist/components/markdown.js +1 -1
- package/dist/components/menu.js +2 -2
- package/dist/components/page-header.js +1 -1
- package/dist/components/pagination.js +1 -1
- package/dist/components/playground.js +9 -9
- package/dist/components/select.js +1 -1
- package/dist/components/sheet.js +1 -1
- package/dist/components/sidebar.js +1 -1
- package/dist/components/tabs.js +4 -4
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/theme-menu.js +3 -3
- package/dist/components/theme-select.js +2 -2
- package/dist/components/toast.js +40 -38
- package/dist/components/toast.js.map +1 -1
- package/dist/index.js +69 -68
- package/dist/kaeso.css +19 -12
- package/dist/styles.css +1 -1
- package/dist/theme.js +1 -1
- package/dist/types/components/combobox/combobox.d.ts +2 -0
- package/dist/types/components/filter-toggle/docs.d.ts +11 -0
- package/dist/types/components/filter-toggle/filter-toggle.d.ts +23 -0
- package/dist/types/components/filter-toggle/index.d.ts +1 -0
- package/dist/types/components/kaeso/docs.d.ts +1 -0
- package/dist/types/components/kaeso/identity.d.ts +1 -0
- package/dist/types/components/kaeso/provider-marks.d.ts +27 -2
- package/dist/types/components/menu/styles.d.ts +1 -1
- package/dist/types/components/tabs/tabs.d.ts +2 -2
- package/dist/types/index.d.ts +1 -0
- package/package.json +5 -5
- package/dist/chunks/button-IblhXUyZ.js.map +0 -1
- package/dist/chunks/combobox-DkcjkWc6.js.map +0 -1
- package/dist/chunks/core-CmK-8ObW.js.map +0 -1
- package/dist/chunks/data-table-CqY8_6IS.js +0 -581
- package/dist/chunks/data-table-CqY8_6IS.js.map +0 -1
- package/dist/chunks/identity-3Foi5F8w.js +0 -361
- package/dist/chunks/identity-3Foi5F8w.js.map +0 -1
- package/dist/chunks/list-B4G-sWwV.js.map +0 -1
- package/dist/chunks/styles-hkFkoBbi.js +0 -21
- package/dist/chunks/styles-hkFkoBbi.js.map +0 -1
- package/dist/chunks/theme-provider-DJhORMlc.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-Bo5-UZg2.js","names":["__icon_Search01Icon","__icon_Cancel01Icon","warnStylingClassName","useUiText","Icon","KbdSequence","useField","useFieldControl","withField","InputGroup","INPUT_ICON_SIZE","KAESO_INPUT_VARIANTS","KAESO_INPUT_DEFAULT_VARIANTS","Input","force","rest","props","className","field","fc","inner","InputGroupFromField","invalid","error","label","description","align","id","leadingIcon","trailing","size","prefix","children","suffix","KAESO_SEARCH_INPUT_VARIANTS","KAESO_SEARCH_INPUT_DEFAULT_VARIANTS","SearchInput","t","setInner","useState","defaultValue","controlled","value","current","input","useRef","clear","el","onClear","ref","Search01Icon","placeholder","onChange","onKeyDown","Cancel01Icon","shortcut"],"sources":["../../src/components/input/input.tsx"],"sourcesContent":["import { forwardRef, useRef, useState, type InputHTMLAttributes, type KeyboardEvent, type ReactNode } from \"react\";\nimport { warnStylingClassName } from \"../../utils/dev.js\";\nimport { useField, useFieldControl, withField, type FieldWrapProps } from \"../field/field.js\";\nimport { InputGroup, INPUT_ICON_SIZE, type InputSize } from \"./input-group.js\";\nimport { Icon, type IconData } from \"../icon/icon.js\";\nimport { KbdSequence } from \"../kbd/kbd.js\";\nimport { Search01Icon as __icon_Search01Icon, Cancel01Icon as __icon_Cancel01Icon } from \"@hugeicons/core-free-icons\";\nimport { useUiText } from \"../../i18n/context.js\";\n\nexport const KAESO_INPUT_VARIANTS = {\n size: {\n sm: { classes: \"h-32\" },\n md: { classes: \"h-36\" },\n lg: { classes: \"h-40\" },\n xl: { classes: \"h-48\" },\n },\n} as const;\nexport const KAESO_INPUT_DEFAULT_VARIANTS = { size: \"md\" } as const;\n\nexport interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, \"size\" | \"prefix\">, FieldWrapProps {\n size?: InputSize | undefined;\n leadingIcon?: IconData | undefined;\n prefix?: ReactNode | undefined;\n suffix?: ReactNode | undefined;\n trailing?: ReactNode | undefined;\n invalid?: boolean | undefined;\n align?: \"start\" | \"end\" | undefined;\n \"data-force\"?: string | undefined;\n className?: string | undefined;\n}\n\nexport const Input = /* @__PURE__ */ forwardRef<HTMLInputElement, InputProps>(function Input(props, ref) {\n const {\n size = \"md\",\n leadingIcon,\n prefix,\n suffix,\n trailing,\n invalid,\n align,\n label,\n description,\n error,\n optional,\n required,\n layout,\n className,\n disabled,\n readOnly,\n id,\n \"data-force\": force,\n ...rest\n } = props;\n warnStylingClassName(\"Input\", className);\n const field = useField();\n const fc = useFieldControl(props);\n const inner = (\n <InputGroupFromField\n size={size}\n leadingIcon={leadingIcon}\n prefix={prefix}\n suffix={suffix}\n trailing={trailing}\n invalid={invalid || !!error}\n disabled={disabled}\n readOnly={readOnly}\n force={force}\n className={label || description || error ? undefined : className}\n >\n <InputGroup.Input\n ref={ref}\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n className={align === \"end\" ? \"text-end tabular\" : undefined}\n {...(id ? { id } : {})}\n {...fc.controlProps}\n {...(invalid || error ? { \"aria-invalid\": true } : {})}\n {...rest}\n />\n </InputGroupFromField>\n );\n if (field) return inner;\n return withField({ label, description, error, optional, required, layout, id: fc.wrapId ?? id, disabled, className }, inner);\n});\nif (process.env.NODE_ENV !== \"production\") Input.displayName = \"Input\";\n\nfunction InputGroupFromField({\n size,\n leadingIcon,\n prefix,\n suffix,\n trailing,\n invalid,\n disabled,\n readOnly,\n force,\n className,\n children,\n}: {\n size: InputSize;\n leadingIcon?: IconData | undefined;\n prefix?: ReactNode | undefined;\n suffix?: ReactNode | undefined;\n trailing?: ReactNode | undefined;\n invalid?: boolean | undefined;\n disabled?: boolean | undefined;\n readOnly?: boolean | undefined;\n force?: string | undefined;\n className?: string | undefined;\n children: ReactNode;\n}) {\n return (\n <InputGroup\n size={size}\n leadingIcon={!!leadingIcon}\n trailingButton={!!trailing}\n invalid={invalid}\n disabled={disabled}\n readOnly={readOnly}\n className={className}\n {...(force ? { \"data-force\": force } : {})}\n >\n {leadingIcon && <Icon icon={leadingIcon} size={INPUT_ICON_SIZE[size]} className=\"text-fg-tertiary\" />}\n {prefix && <InputGroup.Addon data-join>{prefix}</InputGroup.Addon>}\n {children}\n {suffix && <InputGroup.Addon>{suffix}</InputGroup.Addon>}\n {trailing}\n </InputGroup>\n );\n}\n\nexport const KAESO_SEARCH_INPUT_VARIANTS = {\n size: {\n sm: { classes: KAESO_INPUT_VARIANTS.size.sm.classes },\n md: { classes: KAESO_INPUT_VARIANTS.size.md.classes },\n lg: { classes: KAESO_INPUT_VARIANTS.size.lg.classes },\n xl: { classes: KAESO_INPUT_VARIANTS.size.xl.classes },\n },\n} as const;\nexport const KAESO_SEARCH_INPUT_DEFAULT_VARIANTS = { size: \"sm\" } as const;\n\nexport interface SearchInputProps extends Omit<InputProps, \"leadingIcon\" | \"type\" | \"prefix\" | \"suffix\"> {\n shortcut?: string[] | undefined;\n onClear?: (() => void) | undefined;\n placeholder?: string | undefined;\n}\n\nexport const SearchInput = /* @__PURE__ */ forwardRef<HTMLInputElement, SearchInputProps>(function SearchInput(\n { shortcut, onClear, value, defaultValue, onChange, onKeyDown, placeholder, size = \"sm\", ...props },\n ref,\n) {\n const t = useUiText();\n const [inner, setInner] = useState(String(defaultValue ?? \"\"));\n const controlled = value !== undefined;\n const current = controlled ? String(value) : inner;\n const input = useRef<HTMLInputElement | null>(null);\n const clear = () => {\n const el = input.current;\n if (!controlled) setInner(\"\");\n else if (el && !onClear) {\n Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, \"value\")?.set?.call(el, \"\");\n el.dispatchEvent(new Event(\"input\", { bubbles: true }));\n }\n onClear?.();\n el?.focus();\n };\n return (\n <Input\n ref={(el) => {\n input.current = el;\n if (typeof ref === \"function\") ref(el);\n else if (ref) ref.current = el;\n }}\n type=\"search\"\n size={size}\n leadingIcon={__icon_Search01Icon}\n placeholder={placeholder ?? t(\"searchInput.placeholder\", \"Search\")}\n autoComplete=\"off\"\n spellCheck={false}\n value={current}\n onChange={(e) => {\n if (!controlled) setInner(e.target.value);\n onChange?.(e);\n }}\n onKeyDown={(e: KeyboardEvent<HTMLInputElement>) => {\n if (e.key === \"Escape\" && current) {\n e.stopPropagation();\n clear();\n }\n onKeyDown?.(e);\n }}\n trailing={\n current && !props.readOnly && !props.disabled ? (\n <InputGroup.Button icon={__icon_Cancel01Icon} aria-label={t(\"searchInput.clear\", \"Clear search\")} onClick={clear} />\n ) : undefined\n }\n suffix={\n !current && shortcut ? (\n <KbdSequence keys={shortcut} className={props[\"data-force\"]?.includes(\"focus\") ? \"invisible\" : \"group-focus-within/field:invisible\"} />\n ) : undefined\n }\n {...props}\n />\n );\n});\nif (process.env.NODE_ENV !== \"production\") SearchInput.displayName = \"SearchInput\";\n"],"mappings":";;;;;;;;;;;AASA,IAAaW,IAAuB,EAClC,MAAM;CACJ,IAAI,EAAE,SAAS,OAAO;CACtB,IAAI,EAAE,SAAS,OAAO;CACtB,IAAI,EAAE,SAAS,OAAO;CACtB,IAAI,EAAE,SAAS,OAAO;AACxB,EACF,GACaC,IAA+B,EAAE,MAAM,KAAK,GAc5CC,IAAwB,kBAAyC,SAAe,GAAO,GAAK;CACvG,IAAM,EACJ,UAAO,MACP,gBACA,WACA,WACA,aACA,YACA,UACA,UACA,gBACA,UACA,aACA,aACA,WACA,cACA,aACA,aACA,OACA,cAAcC,GACd,GAAGC,MACDC;CACJ,EAAqB,SAASC,CAAS;CACvC,IAAMC,IAAQZ,EAAS,GACjBa,IAAKZ,EAAgBS,CAAK,GAC1BI,IACJ,kBAACC,GAAD;EACQ;EACO;EACL;EACA;EACE;EACV,SAASC,KAAW,CAAC,CAACC;EACZ;EACA;EACH;EACP,WAAWC,KAASC,KAAeF,IAAQ,KAAA,IAAYN;EAEvD,UAAA,kBAACR,EAAW,OAAZ;GACO;GACK;GACA;GACA;GACV,WAAWiB,MAAU,QAAQ,qBAAqB,KAAA;GAClD,GAAKC,IAAK,EA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A,IAAA,aAA6B,iBAAc,EAAY,cAAc"}
|
|
1
|
+
{"version":3,"file":"input-D1SeLe3X.js","names":["__icon_Search01Icon","__icon_Cancel01Icon","warnStylingClassName","useUiText","Icon","KbdSequence","useField","useFieldControl","withField","InputGroup","INPUT_ICON_SIZE","KAESO_INPUT_VARIANTS","KAESO_INPUT_DEFAULT_VARIANTS","Input","force","rest","props","className","field","fc","inner","InputGroupFromField","invalid","error","label","description","align","id","leadingIcon","trailing","size","prefix","children","suffix","KAESO_SEARCH_INPUT_VARIANTS","KAESO_SEARCH_INPUT_DEFAULT_VARIANTS","SearchInput","t","setInner","useState","defaultValue","controlled","value","current","input","useRef","clear","el","onClear","ref","Search01Icon","placeholder","onChange","onKeyDown","Cancel01Icon","shortcut"],"sources":["../../src/components/input/input.tsx"],"sourcesContent":["import { forwardRef, useRef, useState, type InputHTMLAttributes, type KeyboardEvent, type ReactNode } from \"react\";\nimport { warnStylingClassName } from \"../../utils/dev.js\";\nimport { useField, useFieldControl, withField, type FieldWrapProps } from \"../field/field.js\";\nimport { InputGroup, INPUT_ICON_SIZE, type InputSize } from \"./input-group.js\";\nimport { Icon, type IconData } from \"../icon/icon.js\";\nimport { KbdSequence } from \"../kbd/kbd.js\";\nimport { Search01Icon as __icon_Search01Icon, Cancel01Icon as __icon_Cancel01Icon } from \"@hugeicons/core-free-icons\";\nimport { useUiText } from \"../../i18n/context.js\";\n\nexport const KAESO_INPUT_VARIANTS = {\n size: {\n sm: { classes: \"h-32\" },\n md: { classes: \"h-36\" },\n lg: { classes: \"h-40\" },\n xl: { classes: \"h-48\" },\n },\n} as const;\nexport const KAESO_INPUT_DEFAULT_VARIANTS = { size: \"md\" } as const;\n\nexport interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, \"size\" | \"prefix\">, FieldWrapProps {\n size?: InputSize | undefined;\n leadingIcon?: IconData | undefined;\n prefix?: ReactNode | undefined;\n suffix?: ReactNode | undefined;\n trailing?: ReactNode | undefined;\n invalid?: boolean | undefined;\n align?: \"start\" | \"end\" | undefined;\n \"data-force\"?: string | undefined;\n className?: string | undefined;\n}\n\nexport const Input = /* @__PURE__ */ forwardRef<HTMLInputElement, InputProps>(function Input(props, ref) {\n const {\n size = \"md\",\n leadingIcon,\n prefix,\n suffix,\n trailing,\n invalid,\n align,\n label,\n description,\n error,\n optional,\n required,\n layout,\n className,\n disabled,\n readOnly,\n id,\n \"data-force\": force,\n ...rest\n } = props;\n warnStylingClassName(\"Input\", className);\n const field = useField();\n const fc = useFieldControl(props);\n const inner = (\n <InputGroupFromField\n size={size}\n leadingIcon={leadingIcon}\n prefix={prefix}\n suffix={suffix}\n trailing={trailing}\n invalid={invalid || !!error}\n disabled={disabled}\n readOnly={readOnly}\n force={force}\n className={label || description || error ? undefined : className}\n >\n <InputGroup.Input\n ref={ref}\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n className={align === \"end\" ? \"text-end tabular\" : undefined}\n {...(id ? { id } : {})}\n {...fc.controlProps}\n {...(invalid || error ? { \"aria-invalid\": true } : {})}\n {...rest}\n />\n </InputGroupFromField>\n );\n if (field) return inner;\n return withField({ label, description, error, optional, required, layout, id: fc.wrapId ?? id, disabled, className }, inner);\n});\nif (process.env.NODE_ENV !== \"production\") Input.displayName = \"Input\";\n\nfunction InputGroupFromField({\n size,\n leadingIcon,\n prefix,\n suffix,\n trailing,\n invalid,\n disabled,\n readOnly,\n force,\n className,\n children,\n}: {\n size: InputSize;\n leadingIcon?: IconData | undefined;\n prefix?: ReactNode | undefined;\n suffix?: ReactNode | undefined;\n trailing?: ReactNode | undefined;\n invalid?: boolean | undefined;\n disabled?: boolean | undefined;\n readOnly?: boolean | undefined;\n force?: string | undefined;\n className?: string | undefined;\n children: ReactNode;\n}) {\n return (\n <InputGroup\n size={size}\n leadingIcon={!!leadingIcon}\n trailingButton={!!trailing}\n invalid={invalid}\n disabled={disabled}\n readOnly={readOnly}\n className={className}\n {...(force ? { \"data-force\": force } : {})}\n >\n {leadingIcon && <Icon icon={leadingIcon} size={INPUT_ICON_SIZE[size]} className=\"text-fg-tertiary\" />}\n {prefix && <InputGroup.Addon data-join>{prefix}</InputGroup.Addon>}\n {children}\n {suffix && <InputGroup.Addon>{suffix}</InputGroup.Addon>}\n {trailing}\n </InputGroup>\n );\n}\n\nexport const KAESO_SEARCH_INPUT_VARIANTS = {\n size: {\n sm: { classes: KAESO_INPUT_VARIANTS.size.sm.classes },\n md: { classes: KAESO_INPUT_VARIANTS.size.md.classes },\n lg: { classes: KAESO_INPUT_VARIANTS.size.lg.classes },\n xl: { classes: KAESO_INPUT_VARIANTS.size.xl.classes },\n },\n} as const;\nexport const KAESO_SEARCH_INPUT_DEFAULT_VARIANTS = { size: \"sm\" } as const;\n\nexport interface SearchInputProps extends Omit<InputProps, \"leadingIcon\" | \"type\" | \"prefix\" | \"suffix\"> {\n shortcut?: string[] | undefined;\n onClear?: (() => void) | undefined;\n placeholder?: string | undefined;\n}\n\nexport const SearchInput = /* @__PURE__ */ forwardRef<HTMLInputElement, SearchInputProps>(function SearchInput(\n { shortcut, onClear, value, defaultValue, onChange, onKeyDown, placeholder, size = \"sm\", ...props },\n ref,\n) {\n const t = useUiText();\n const [inner, setInner] = useState(String(defaultValue ?? \"\"));\n const controlled = value !== undefined;\n const current = controlled ? String(value) : inner;\n const input = useRef<HTMLInputElement | null>(null);\n const clear = () => {\n const el = input.current;\n if (!controlled) setInner(\"\");\n else if (el && !onClear) {\n Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, \"value\")?.set?.call(el, \"\");\n el.dispatchEvent(new Event(\"input\", { bubbles: true }));\n }\n onClear?.();\n el?.focus();\n };\n return (\n <Input\n ref={(el) => {\n input.current = el;\n if (typeof ref === \"function\") ref(el);\n else if (ref) ref.current = el;\n }}\n type=\"search\"\n size={size}\n leadingIcon={__icon_Search01Icon}\n placeholder={placeholder ?? t(\"searchInput.placeholder\", \"Search\")}\n autoComplete=\"off\"\n spellCheck={false}\n value={current}\n onChange={(e) => {\n if (!controlled) setInner(e.target.value);\n onChange?.(e);\n }}\n onKeyDown={(e: KeyboardEvent<HTMLInputElement>) => {\n if (e.key === \"Escape\" && current) {\n e.stopPropagation();\n clear();\n }\n onKeyDown?.(e);\n }}\n trailing={\n current && !props.readOnly && !props.disabled ? (\n <InputGroup.Button icon={__icon_Cancel01Icon} aria-label={t(\"searchInput.clear\", \"Clear search\")} onClick={clear} />\n ) : undefined\n }\n suffix={\n !current && shortcut ? (\n <KbdSequence keys={shortcut} className={props[\"data-force\"]?.includes(\"focus\") ? \"invisible\" : \"group-focus-within/field:invisible\"} />\n ) : undefined\n }\n {...props}\n />\n );\n});\nif (process.env.NODE_ENV !== \"production\") SearchInput.displayName = \"SearchInput\";\n"],"mappings":";;;;;;;;;;;AASA,IAAaW,IAAuB,EAClC,MAAM;CACJ,IAAI,EAAE,SAAS,OAAO;CACtB,IAAI,EAAE,SAAS,OAAO;CACtB,IAAI,EAAE,SAAS,OAAO;CACtB,IAAI,EAAE,SAAS,OAAO;AACxB,EACF,GACaC,IAA+B,EAAE,MAAM,KAAK,GAc5CC,IAAwB,kBAAyC,SAAe,GAAO,GAAK;CACvG,IAAM,EACJ,UAAO,MACP,gBACA,WACA,WACA,aACA,YACA,UACA,UACA,gBACA,UACA,aACA,aACA,WACA,cACA,aACA,aACA,OACA,cAAcC,GACd,GAAGC,MACDC;CACJ,EAAqB,SAASC,CAAS;CACvC,IAAMC,IAAQZ,EAAS,GACjBa,IAAKZ,EAAgBS,CAAK,GAC1BI,IACJ,kBAACC,GAAD;EACQ;EACO;EACL;EACA;EACE;EACV,SAASC,KAAW,CAAC,CAACC;EACZ;EACA;EACH;EACP,WAAWC,KAASC,KAAeF,IAAQ,KAAA,IAAYN;EAEvD,UAAA,kBAACR,EAAW,OAAZ;GACO;GACK;GACA;GACA;GACV,WAAWiB,MAAU,QAAQ,qBAAqB,KAAA;GAClD,GAAKC,IAAK,EAAE,MAAG,IAAI,CAAC;GACpB,GAAIR,EAAG;GACP,GAAKG,KA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7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { t as e } from "./cn-BjnOAUrA.js";
|
|
3
3
|
import { t } from "./icon-CBzOwqrX.js";
|
|
4
|
-
import { n } from "./button-
|
|
4
|
+
import { n } from "./button-DrmFgdIi.js";
|
|
5
5
|
import { createContext as r, forwardRef as i, useContext as a } from "react";
|
|
6
6
|
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
7
7
|
//#region src/utils/field-press.ts
|
|
@@ -103,4 +103,4 @@ var b = /* @__PURE__ */ Object.assign(g, {
|
|
|
103
103
|
//#endregion
|
|
104
104
|
export { d as a, l as i, b as n, x as o, u as r, p as t };
|
|
105
105
|
|
|
106
|
-
//# sourceMappingURL=input-group-
|
|
106
|
+
//# sourceMappingURL=input-group-BbxwEAUP.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-group-
|
|
1
|
+
{"version":3,"file":"input-group-BbxwEAUP.js","names":["cn","focusInputOnPress","input","KAESO_INPUT_GROUP_VARIANTS","KAESO_INPUT_GROUP_DEFAULT_VARIANTS","LEADING","TRAILING_BUTTON","INPUT_ICON_SIZE","PREFIX_JOIN","Ctx","Root","props","size","leadingIcon","trailingButton","disabled","className","invalid","readOnly","Input","useContext","Addon","join","icon","Icon","children","GroupButton","Button","InputGroup","useInputGroupSize"],"sources":["../../src/utils/field-press.ts","../../src/components/input/input-group.tsx"],"sourcesContent":["import type { MouseEvent } from \"react\";\n\nexport function focusInputOnPress(e: MouseEvent<HTMLElement>) {\n if (e.target !== e.currentTarget) return;\n const input = e.currentTarget.querySelector(\"input:not([type=hidden])\") as HTMLInputElement | null;\n if (!input || input.disabled) return;\n e.preventDefault();\n input.focus();\n}\n","import type * as React from \"react\";\nimport { createContext, forwardRef, useContext, type HTMLAttributes, type InputHTMLAttributes } from \"react\";\nimport { cn } from \"../../utils/cn.js\";\nimport { focusInputOnPress } from \"../../utils/field-press.js\";\nimport { Icon, type IconData, type IconSize } from \"../icon/icon.js\";\nimport { Button } from \"../button/button.js\";\n\nexport const KAESO_INPUT_GROUP_VARIANTS = {\n size: {\n sm: { classes: \"h-32 px-12 gap-6 text-body\" },\n md: { classes: \"h-36 px-16 gap-8 text-body\" },\n lg: { classes: \"h-40 px-18 gap-8 text-body\" },\n xl: { classes: \"h-48 px-22 gap-8 text-body-lg\" },\n },\n} as const;\nexport const KAESO_INPUT_GROUP_DEFAULT_VARIANTS = { size: \"md\" } as const;\nexport type InputSize = keyof typeof KAESO_INPUT_GROUP_VARIANTS.size;\n\nexport const LEADING: Record<InputSize, string> = { sm: \"pl-10\", md: \"pl-14\", lg: \"pl-16\", xl: \"pl-20\" };\nconst TRAILING_BUTTON: Record<InputSize, string> = { sm: \"pr-4\", md: \"pr-2\", lg: \"pr-4\", xl: \"pr-6\" };\nexport const INPUT_ICON_SIZE: Record<InputSize, IconSize> = { sm: \"sm\", md: \"sm\", lg: \"md\", xl: \"lg\" };\n\nconst PREFIX_JOIN: Record<InputSize, string> = { sm: \"-me-6\", md: \"-me-8\", lg: \"-me-8\", xl: \"-me-8\" };\n\nconst Ctx = /* @__PURE__ */ createContext<{ size: InputSize; invalid?: boolean | undefined; disabled?: boolean | undefined }>({ size: \"md\" });\n\nexport interface InputGroupProps extends HTMLAttributes<HTMLDivElement> {\n size?: InputSize | undefined;\n leadingIcon?: boolean | undefined;\n trailingButton?: boolean | undefined;\n invalid?: boolean | undefined;\n disabled?: boolean | undefined;\n readOnly?: boolean | undefined;\n \"data-force\"?: string | undefined;\n}\n\nconst Root = /* @__PURE__ */ forwardRef<HTMLDivElement, InputGroupProps>(function InputGroup(\n { size = \"md\", leadingIcon, trailingButton, invalid, disabled, readOnly, className, children, ...props },\n ref,\n) {\n return (\n <Ctx.Provider value={{ size, invalid, disabled }}>\n <div\n ref={ref}\n className={cn(\n \"group/field relative flex w-full min-w-0 items-center rounded-pill material-field transition-control cursor-text\",\n KAESO_INPUT_GROUP_VARIANTS.size[size].classes,\n leadingIcon && LEADING[size],\n trailingButton && TRAILING_BUTTON[size],\n disabled && \"cursor-not-allowed\",\n className,\n )}\n {...(invalid ? { \"data-invalid\": \"\" } : {})}\n {...(disabled ? { \"data-disabled\": \"\" } : {})}\n {...(readOnly ? { \"data-readonly\": \"\" } : {})}\n onMouseDown={focusInputOnPress}\n {...props}\n >\n {children}\n </div>\n </Ctx.Provider>\n );\n});\nif (process.env.NODE_ENV !== \"production\") Root.displayName = \"InputGroup\";\n\nexport interface InputGroupInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, \"size\"> {}\n\nconst Input = /* @__PURE__ */ forwardRef<HTMLInputElement, InputGroupInputProps>(function InputGroupInput({ className, ...props }, ref) {\n const { invalid, disabled } = useContext(Ctx);\n return (\n <input\n ref={ref}\n {...(invalid ? { \"aria-invalid\": true } : {})}\n {...(disabled ? { disabled: true } : {})}\n className={cn(\n \"min-w-0 flex-1 bg-transparent bidi-plaintext text-inherit text-fg outline-none placeholder:text-fg-tertiary disabled:cursor-not-allowed disabled:text-fg-disabled read-only:cursor-text data-mono:mono data-mono:text-small\",\n className,\n )}\n {...props}\n />\n );\n});\nif (process.env.NODE_ENV !== \"production\") Input.displayName = \"InputGroup.Input\";\n\nexport interface InputGroupAddonProps extends HTMLAttributes<HTMLSpanElement> {\n icon?: IconData | undefined;\n \"data-join\"?: boolean | undefined;\n}\n\nconst Addon = /* @__PURE__ */ forwardRef<HTMLSpanElement, InputGroupAddonProps>(function InputGroupAddon({ icon, className, children, \"data-join\": join, ...props }, ref) {\n const { size } = useContext(Ctx);\n return (\n <span\n ref={ref}\n className={cn(\"inline-flex shrink-0 items-center gap-4 bidi-plaintext text-fg-secondary select-none\", join && PREFIX_JOIN[size], className)}\n {...props}\n >\n {icon && <Icon icon={icon} size={INPUT_ICON_SIZE[size]} />}\n {children}\n </span>\n );\n});\nif (process.env.NODE_ENV !== \"production\") Addon.displayName = \"InputGroup.Addon\";\n\nexport interface InputGroupButtonProps {\n icon: IconData;\n \"aria-label\": string;\n onClick?: (() => void) | undefined;\n disabled?: boolean | undefined;\n className?: string | undefined;\n}\n\nconst GroupButton = /* @__PURE__ */ forwardRef<HTMLButtonElement, InputGroupButtonProps>(function InputGroupButton({ icon, className, ...props }, ref) {\n const { size, disabled } = useContext(Ctx);\n return (\n <Button\n {...(disabled ? { disabled: true } : {})}\n ref={ref as React.Ref<HTMLButtonElement & HTMLAnchorElement>}\n shape=\"circle\"\n variant=\"quiet\"\n size={size === \"xl\" ? \"md\" : size === \"lg\" ? \"sm\" : size === \"md\" ? \"sm\" : \"xs\"}\n icon={icon}\n className={className}\n {...props}\n />\n );\n});\nif (process.env.NODE_ENV !== \"production\") GroupButton.displayName = \"InputGroup.Button\";\n\nexport const InputGroup = /* @__PURE__ */ Object.assign(Root, { Input, Addon, Button: GroupButton });\nexport const useInputGroupSize = () => useContext(Ctx).size;\n"],"mappings":";;;;;;;AAEA,SAAgBC,EAAkB,GAA4B;CAC5D,IAAI,EAAE,WAAW,EAAE,eAAe;CAClC,IAAMC,IAAQ,EAAE,cAAc,cAAc,0BAA0B;CACtE,AAAKA,KAAS,GAAM,aACpB,EAAE,eAAe,GACjBA,EAAM,MAAM;AACd;;;ACDA,IAAaC,IAA6B,EACxC,MAAM;CACJ,IAAI,EAAE,SAAS,6BAA6B;CAC5C,IAAI,EAAE,SAAS,6BAA6B;CAC5C,IAAI,EAAE,SAAS,6BAA6B;CAC5C,IAAI,EAAE,SAAS,gCAAgC;AACjD,EACF,GACaC,IAAqC,EAAE,MAAM,KAAK,GAGlDC,IAAqC;CAAE,IAAI;CAAS,IAAI;CAAS,IAAI;CAAS,IAAI;AAAQ,GACjGC,IAA6C;CAAE,IAAI;CAAQ,IAAI;CAAQ,IAAI;CAAQ,IAAI;AAAO,GACvFC,IAA+C;CAAE,IAAI;CAAM,IAAI;CAAM,IAAI;CAAM,IAAI;AAAK,GAE/FC,IAAyC;CAAE,IAAI;CAAS,IAAI;CAAS,IAAI;CAAS,IAAI;AAAQ,GAE9FC,IAAsB,kBAA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AAQ,kBAACC,GAAD;GAAY;GAAM,MAAMjB,EAAgBK;EAAQ,CAAA,GACxDa,CACG;;AAEV,CAAC;AACD,QAAA,IAAA,aAA6B,iBAAc,EAAM,cAAc;AAU/D,IAAMC,IAA8B,kBAAqD,SAA0B,EAAE,SAAM,cAAW,GAAGf,KAAS,GAAK;CACrJ,IAAM,EAAE,SAAM,gBAAaS,EAAWX,CAAG;CACzC,OACE,kBAACkB,GAAD;EACE,GAAKZ,IAAW,EAAE,UAAU,GAAK,IAAI,CAAC;EACjC;EACL,OAAM;EACN,SAAQ;EACR,MAAMH,MAAS,OAAO,OAAOA,MAAS,QAAcA,MAAS,OAAhB,OAA8B;EACrE;EACK;EACX,GAAID;CACL,CAAA;AAEL,CAAC;AACD,QAAA,IAAA,aAA6B,iBAAc,EAAY,cAAc;AAErE,IAAaiB,IAA6B,uBAAO,OAAOlB,GAAM;CAAE;CAAO;CAAO,QAAQgB;AAAY,CAAC,GACtFG,UAA0BT,EAAWX,CAAG,CAAC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { i as e } from "./context-BELWW79w.js";
|
|
3
3
|
import { formatISODate as t, parseISODate as n } from "../format.js";
|
|
4
|
-
import { n as r } from "./input-group-
|
|
4
|
+
import { n as r } from "./input-group-BbxwEAUP.js";
|
|
5
5
|
import { useState as i } from "react";
|
|
6
6
|
import { jsx as a } from "react/jsx-runtime";
|
|
7
7
|
//#region src/components/date-picker/iso-field.tsx
|
|
@@ -49,4 +49,4 @@ function c(e, t) {
|
|
|
49
49
|
//#endregion
|
|
50
50
|
export { o as n, c as r, s as t };
|
|
51
51
|
|
|
52
|
-
//# sourceMappingURL=iso-field-
|
|
52
|
+
//# sourceMappingURL=iso-field-BVOKAY4H.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iso-field-
|
|
1
|
+
{"version":3,"file":"iso-field-BVOKAY4H.js","names":["useUiText","InputGroup","IsoField","t","text","setText","useState","value","formatISODate","shown","setShown","commit","typed","onProblem","d","parseISODate","onCommit","label","invalid","errorId","ISO_PROBLEM","isoProblemText","problem"],"sources":["../../src/components/date-picker/iso-field.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport { InputGroup } from \"../input/input-group.js\";\nimport { formatISODate, parseISODate } from \"../../format/index.js\";\nimport { useUiText, type UiText } from \"../../i18n/context.js\";\n\nexport type IsoProblem = \"format\" | \"unavailable\" | \"missing\" | null;\n\nexport function IsoField({\n label,\n value,\n onCommit,\n onProblem,\n errorId,\n invalid,\n}: {\n label: string;\n value: Date | undefined;\n onCommit: (d: Date) => boolean | void;\n onProblem: (problem: IsoProblem) => void;\n errorId: string;\n invalid: boolean;\n}) {\n const t = useUiText();\n const [text, setText] = useState(value ? formatISODate(value) : \"\");\n const [shown, setShown] = useState(value);\n if (value !== shown) {\n setShown(value);\n setText(value ? formatISODate(value) : \"\");\n }\n const commit = () => {\n const typed = text.trim();\n if (!typed) {\n setText(value ? formatISODate(value) : \"\");\n onProblem(null);\n return;\n }\n const d = parseISODate(typed);\n if (!d) return onProblem(\"format\");\n if (value && formatISODate(d) === formatISODate(value)) {\n setText(formatISODate(value));\n return onProblem(null);\n }\n if (onCommit(d) === false) return onProblem(\"unavailable\");\n onProblem(null);\n };\n return (\n <InputGroup size=\"sm\" className=\"flex-1\" invalid={invalid}>\n <InputGroup.Input\n aria-label={label}\n placeholder={t(\"datePicker.isoPlaceholder\", \"YYYY-MM-DD\")}\n value={text}\n inputMode=\"numeric\"\n className=\"mono text-small\"\n {...(invalid ? { \"aria-invalid\": true, \"aria-describedby\": errorId } : {})}\n onChange={(e) => setText(e.target.value)}\n onBlur={commit}\n onKeyDown={(e) => {\n if (e.key !== \"Enter\") return;\n e.preventDefault();\n commit();\n }}\n />\n </InputGroup>\n );\n}\n\nexport const ISO_PROBLEM = \"mt-6 text-small text-pretty text-danger-text empty:mt-0\";\n\nexport function isoProblemText(t: UiText, problem: IsoProblem): string {\n if (problem === \"format\") return t(\"datePicker.typeIso\", \"Enter the date as YYYY-MM-DD.\");\n if (problem === \"unavailable\") return t(\"datePicker.unavailableDate\", \"This date can't be chosen. Choose another date.\");\n if (problem === \"missing\") return t(\"datePicker.startFirst\", \"Choose a start date first.\");\n return \"\";\n}\n"],"mappings":";;;;;;;AAOA,SAAgBE,EAAS,EACvB,UACA,UACA,aACA,cACA,YACA,cAQC;CACD,IAAMC,IAAIH,EAAU,GACd,CAACI,GAAMC,KAAWC,EAASC,IAAQC,EAAcD,CAAK,IAAI,EAAE,GAC5D,CAACE,GAAOC,KAAYJ,EAASC,CAAK;CACxC,AAAIA,MAAUE,MACZC,EAASH,CAAK,GACdF,EAAQE,IAAQC,EAAcD,CAAK,IAAI,EAAE;CAE3C,IAAMI,UAAe;EACnB,IAAMC,IAAQR,EAAK,KAAK;EACxB,IAAI,CAACQ,GAAO;GAEV,AADAP,EAAQE,IAAQC,EAAcD,CAAK,IAAI,EAAE,GACzCM,EAAU,IAAI;GACd;EACF;EACA,IAAMC,IAAIC,EAAaH,CAAK;EAC5B,IAAI,CAACE,GAAG,OAAOD,EAAU,QAAQ;EACjC,IAAIN,KAASC,EAAcM,CAAC,MAAMN,EAAcD,CAAK,GAEnD,OADAF,EAAQG,EAAcD,CAAK,CAAC,GACrBM,EAAU,IAAI;EAEvB,IAAIG,EAASF,CAAC,MAAM,IAAO,OAAOD,EAAU,aAAa;EACzD,EAAU,IAAI;CAChB;CACA,OACE,kBAACZ,GAAD;EAAY,MAAK;EAAK,WAAU;EAAkB;EAChD,UAAA,kBAACA,EAAW,OAAZ;GACE,cAAYgB;GACZ,aAAad,EAAE,6BAA6B,YAAY;GACxD,OAAOC;GACP,WAAU;GACV,WAAU;GACV,GAAKc,IAAU;IAAE,gBAAgB;IAAM,oBAAoBC;GAAQ,IAAI,CAAC;GACxE,WAAW,MAAMd,EAAQ,EAAE,OAAO,KAAK;GACvC,QAAQM;GACR,YAAY,MAAM;IAChB,AAAI,EAAE,QAAQ,YACd,EAAE,eAAe,GACjBA,EAAO;GACT;EACD,CAAA;CACS,CAAA;AAEhB;AAEA,IAAaS,IAAc;AAE3B,SAAgBC,EAAe,GAAW,GAA6B;CAIrE,OAHIC,MAAY,WAAiBnB,EAAE,sBAAsB,+BAA+B,IACpFmB,MAAY,gBAAsBnB,EAAE,8BAA8B,iDAAiD,IACnHmB,MAAY,YAAkBnB,EAAE,yBAAyB,4BAA4B,IAClF;AACT"}
|
|
@@ -6,7 +6,7 @@ import { i } from "./context-BELWW79w.js";
|
|
|
6
6
|
import { t as a } from "./icon-CBzOwqrX.js";
|
|
7
7
|
import { s as o, u as s } from "./tooltip-Tkm-urbi.js";
|
|
8
8
|
import { r as c } from "./text-DkKdTVUf.js";
|
|
9
|
-
import { t as l } from "./icon-button-
|
|
9
|
+
import { t as l } from "./icon-button-6kOn2zrP.js";
|
|
10
10
|
import { n as u } from "./use-layout-width-CbSDbRb0.js";
|
|
11
11
|
import { r as d } from "./skeleton-D-qk3mes.js";
|
|
12
12
|
import { t as f } from "./truncated-d1afmUJT.js";
|
|
@@ -16,7 +16,7 @@ import { jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
|
16
16
|
import { Add01Icon as w, Cancel01Icon as T } from "@hugeicons/core-free-icons";
|
|
17
17
|
import { createPortal as E } from "react-dom";
|
|
18
18
|
//#region src/components/list/row-checkbox.tsx
|
|
19
|
-
var D = /* @__PURE__ */ o(() => import("./checkbox-
|
|
19
|
+
var D = /* @__PURE__ */ o(() => import("./checkbox-ahl1SOqU.js").then((e) => e.c), { base: () => import.meta.url });
|
|
20
20
|
function ee({ checked: t, onToggle: n, "aria-label": r }) {
|
|
21
21
|
let [i, a] = s(D, !0), [o, c] = x(!1), [l, u] = x(!1);
|
|
22
22
|
return _(() => {
|
|
@@ -62,16 +62,16 @@ var O = /* @__PURE__ */ o(() => import("./virtual-rows-CC_kc2PR.js"), { base: ()
|
|
|
62
62
|
96: "w-96",
|
|
63
63
|
120: "w-120"
|
|
64
64
|
}, j = 520, M = "a[href], button, input, select, textarea, [tabindex], [contenteditable=true]", N = "input:not([type=checkbox]):not([type=radio]), textarea, select, [contenteditable=true]";
|
|
65
|
-
function
|
|
65
|
+
function ne(e) {
|
|
66
66
|
for (let t of e.querySelectorAll("[role=row]")) {
|
|
67
67
|
let e = t.querySelector("[data-index]");
|
|
68
68
|
if (e) for (let n of t.querySelectorAll(M)) n !== e && n.getAttribute("tabindex") !== "-1" && n.setAttribute("tabindex", "-1");
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
var
|
|
72
|
-
let te = n(), [
|
|
73
|
-
o ||
|
|
74
|
-
}, [o, c]), [
|
|
71
|
+
var P = /* @__PURE__ */ h(function({ items: t, groups: r, onOpen: i, selectable: a, selected: o, onSelectedChange: c, idWidth: l, density: d = "default", wrapSubtitle: f = !1, virtualizeAbove: h = 100, selectionActions: _, selectionBar: w = !0, loading: T, empty: E, className: D, "aria-label": ee, "data-force-row": k }, A) {
|
|
72
|
+
let te = n(), [P, re] = x(/* @__PURE__ */ new Set()), F = o ?? P, z = g((e) => {
|
|
73
|
+
o || re(e), c?.(e);
|
|
74
|
+
}, [o, c]), [B, se] = x(() => new Set((r ?? []).filter((e) => e.defaultCollapsed).map((e) => e.id))), [V, H] = x(-1), [ce, le] = x(null), U = b(null), W = b(null), ue = u(U), G = !!ue && ue < j, K = y(() => {
|
|
75
75
|
let e = (e) => e.flatMap((e) => [{
|
|
76
76
|
kind: "row",
|
|
77
77
|
item: e,
|
|
@@ -89,27 +89,40 @@ var F = /* @__PURE__ */ h(function({ items: t, groups: r, onOpen: i, selectable:
|
|
|
89
89
|
kind: "header",
|
|
90
90
|
group: t,
|
|
91
91
|
key: `h-${t.id}`
|
|
92
|
-
}, ...
|
|
92
|
+
}, ...B.has(t.id) ? [] : e(t.items)]) : e(t ?? []);
|
|
93
93
|
}, [
|
|
94
94
|
t,
|
|
95
95
|
r,
|
|
96
|
-
|
|
97
|
-
]),
|
|
98
|
-
|
|
99
|
-
let
|
|
100
|
-
|
|
101
|
-
let t = () =>
|
|
102
|
-
e && (e.focus(),
|
|
96
|
+
B
|
|
97
|
+
]), de = K.findIndex((e) => e.kind === "row"), fe = r ? r.every((e) => e.items.length === 0) : (t ?? []).length === 0, q = K.length > h, pe = m(), me = (e) => K[e]?.kind === "header" ? e === 0 ? 36 : 52 : G ? 64 : d === "compact" && !pe ? 36 : 44, [he, J] = s(O, q), Y = he?.VirtualRows, ge = b(null);
|
|
98
|
+
V >= K.length && H(-1);
|
|
99
|
+
let _e = V >= 0 ? V : K.length ? 0 : -1, X = (e) => {
|
|
100
|
+
H(e), q && ge.current?.(e);
|
|
101
|
+
let t = () => U.current?.querySelector(`[data-index="${e}"]`), n = (e) => {
|
|
102
|
+
e && (e.focus(), ie(e, W.current));
|
|
103
103
|
}, r = t();
|
|
104
104
|
r ? n(r) : requestAnimationFrame(() => n(t()));
|
|
105
|
-
},
|
|
105
|
+
}, Z = b(null);
|
|
106
106
|
v(() => {
|
|
107
|
-
|
|
107
|
+
let e = Z.current;
|
|
108
|
+
if (!e || K.some((t) => t.key === e.key) || (Z.current = null, !K.length)) return;
|
|
109
|
+
let t = Math.min(e.index, K.length - 1);
|
|
110
|
+
if (document.activeElement === document.body) return X(t);
|
|
111
|
+
let n = document.activeElement?.closest("[role=dialog], [role=alertdialog]");
|
|
112
|
+
if (!n) return;
|
|
113
|
+
let r = performance.now() + 2e3, i = () => {
|
|
114
|
+
document.activeElement === document.body ? U.current?.isConnected && X(t) : n.contains(document.activeElement) && performance.now() < r && requestAnimationFrame(i);
|
|
115
|
+
};
|
|
116
|
+
requestAnimationFrame(i);
|
|
117
|
+
});
|
|
118
|
+
let ve = b(!!Y);
|
|
119
|
+
v(() => {
|
|
120
|
+
Y && !ve.current && V >= 0 && document.activeElement === document.body && U.current?.querySelector(`[data-index="${V}"]`)?.focus(), ve.current = !!Y;
|
|
108
121
|
}), v(() => {
|
|
109
|
-
let e =
|
|
122
|
+
let e = U.current;
|
|
110
123
|
if (!e) return;
|
|
111
|
-
|
|
112
|
-
let t = new MutationObserver(() =>
|
|
124
|
+
ne(e);
|
|
125
|
+
let t = new MutationObserver(() => ne(e));
|
|
113
126
|
return t.observe(e, {
|
|
114
127
|
subtree: !0,
|
|
115
128
|
childList: !0,
|
|
@@ -117,10 +130,10 @@ var F = /* @__PURE__ */ h(function({ items: t, groups: r, onOpen: i, selectable:
|
|
|
117
130
|
attributeFilter: ["tabindex"]
|
|
118
131
|
}), () => t.disconnect();
|
|
119
132
|
}, []);
|
|
120
|
-
let
|
|
121
|
-
let t = new Set(
|
|
122
|
-
t.has(e) ? t.delete(e) : t.add(e),
|
|
123
|
-
},
|
|
133
|
+
let ye = (e) => {
|
|
134
|
+
let t = new Set(F);
|
|
135
|
+
t.has(e) ? t.delete(e) : t.add(e), z(t);
|
|
136
|
+
}, be = (e) => e.flatMap((e) => e.kind === "row" && !e.item.disabled ? [e.item.id] : []), xe = (e) => {
|
|
124
137
|
let t = e.target;
|
|
125
138
|
if (!e.currentTarget.contains(t) || t.closest(N)) return;
|
|
126
139
|
let n = t.closest("[role=row]"), r = n?.querySelector("[data-index]");
|
|
@@ -131,53 +144,53 @@ var F = /* @__PURE__ */ h(function({ items: t, groups: r, onOpen: i, selectable:
|
|
|
131
144
|
return;
|
|
132
145
|
}
|
|
133
146
|
if (e.defaultPrevented) return;
|
|
134
|
-
let s = Number(r.dataset.index), c =
|
|
147
|
+
let s = Number(r.dataset.index), c = K[s], l = c?.kind === "row" ? c.item : void 0;
|
|
135
148
|
if (e.altKey) return;
|
|
136
149
|
if (e.metaKey || e.ctrlKey) {
|
|
137
|
-
e.key.toLowerCase() === "a" && a && !e.shiftKey && (e.preventDefault(),
|
|
150
|
+
e.key.toLowerCase() === "a" && a && !e.shiftKey && (e.preventDefault(), z(new Set(be(K))));
|
|
138
151
|
return;
|
|
139
152
|
}
|
|
140
153
|
let u = (t) => {
|
|
141
154
|
if (e.preventDefault(), e.shiftKey && a) {
|
|
142
|
-
let e =
|
|
143
|
-
|
|
144
|
-
let n = new Set(
|
|
145
|
-
|
|
146
|
-
} else
|
|
147
|
-
|
|
155
|
+
let e = ce ?? s;
|
|
156
|
+
le(e);
|
|
157
|
+
let n = new Set(F);
|
|
158
|
+
be(K.slice(Math.min(e, t), Math.max(e, t) + 1)).forEach((e) => n.add(e)), z(n);
|
|
159
|
+
} else le(null);
|
|
160
|
+
X(t);
|
|
148
161
|
}, d = () => [...n.querySelectorAll(M)].filter((e) => e !== r && !e.closest("[role=checkbox], [aria-hidden=true], [hidden]") && !e.matches(":disabled, input[type=checkbox]"));
|
|
149
|
-
if (e.key === "ArrowDown" || e.key === "j" && !e.shiftKey) u(Math.min(
|
|
162
|
+
if (e.key === "ArrowDown" || e.key === "j" && !e.shiftKey) u(Math.min(K.length - 1, s + 1));
|
|
150
163
|
else if (e.key === "ArrowUp" || e.key === "k" && !e.shiftKey) u(Math.max(0, s - 1));
|
|
151
164
|
else if (e.key === "Home") u(0);
|
|
152
|
-
else if (e.key === "End") u(
|
|
165
|
+
else if (e.key === "End") u(K.length - 1);
|
|
153
166
|
else if (e.key === "ArrowRight" || e.key === "ArrowLeft") {
|
|
154
167
|
let n = d(), i = o ? -1 : n.indexOf(t), a = e.key === "ArrowRight" ? n[i + 1] : i > 0 ? n[i - 1] : i === 0 ? r : void 0;
|
|
155
168
|
if (!a) return;
|
|
156
169
|
e.preventDefault(), a.focus();
|
|
157
170
|
} else if (!o || !l || e.shiftKey) return;
|
|
158
|
-
else (e.key === " " || e.key === "x") && a ? (e.preventDefault(), l.disabled ||
|
|
159
|
-
}, Q =
|
|
171
|
+
else (e.key === " " || e.key === "x") && a ? (e.preventDefault(), l.disabled || ye(l.id)) : e.key === "Enter" ? (e.preventDefault(), l.disabled || i?.(l)) : e.key === "Escape" && a && F.size && z(/* @__PURE__ */ new Set());
|
|
172
|
+
}, Q = F.size > 0;
|
|
160
173
|
v(() => {
|
|
161
174
|
let e = document.activeElement;
|
|
162
|
-
Q && e instanceof HTMLElement &&
|
|
175
|
+
Q && e instanceof HTMLElement && U.current?.contains(e) && ie(e, W.current);
|
|
163
176
|
}, [Q]);
|
|
164
|
-
let $ = (e, t) => e.kind === "header" ? /* @__PURE__ */ S(
|
|
177
|
+
let $ = (e, t) => e.kind === "header" ? /* @__PURE__ */ S(L, {
|
|
165
178
|
title: e.group.title,
|
|
166
179
|
glyph: e.group.glyph,
|
|
167
180
|
count: e.group.count ?? e.group.items.length,
|
|
168
|
-
collapsed:
|
|
181
|
+
collapsed: B.has(e.group.id),
|
|
169
182
|
onToggle: () => {
|
|
170
|
-
let t = new Set(
|
|
171
|
-
t.has(e.group.id) ? t.delete(e.group.id) : t.add(e.group.id),
|
|
183
|
+
let t = new Set(B);
|
|
184
|
+
t.has(e.group.id) ? t.delete(e.group.id) : t.add(e.group.id), se(t);
|
|
172
185
|
},
|
|
173
186
|
onAdd: e.group.onAdd,
|
|
174
187
|
addLabel: e.group.addLabel,
|
|
175
188
|
indent: !!a,
|
|
176
189
|
first: t === 0,
|
|
177
190
|
index: t,
|
|
178
|
-
active: t ===
|
|
179
|
-
onFocus: () =>
|
|
180
|
-
}, e.key) : /* @__PURE__ */ S(
|
|
191
|
+
active: t === _e,
|
|
192
|
+
onFocus: () => H(t)
|
|
193
|
+
}, e.key) : /* @__PURE__ */ S(I, {
|
|
181
194
|
index: t,
|
|
182
195
|
item: e.item,
|
|
183
196
|
depth: e.depth,
|
|
@@ -185,76 +198,86 @@ var F = /* @__PURE__ */ h(function({ items: t, groups: r, onOpen: i, selectable:
|
|
|
185
198
|
idWidth: l,
|
|
186
199
|
density: d,
|
|
187
200
|
wrapSubtitle: f,
|
|
188
|
-
narrow:
|
|
189
|
-
active: t ===
|
|
190
|
-
selected:
|
|
201
|
+
narrow: G,
|
|
202
|
+
active: t === _e,
|
|
203
|
+
selected: F.has(e.item.id),
|
|
191
204
|
selectable: !!a,
|
|
192
205
|
selecting: Q,
|
|
193
|
-
onSelect: () =>
|
|
206
|
+
onSelect: () => ye(e.item.id),
|
|
194
207
|
onOpen: () => i?.(e.item),
|
|
195
|
-
onFocus: () =>
|
|
196
|
-
...k && t ===
|
|
208
|
+
onFocus: () => H(t),
|
|
209
|
+
...k && t === de ? { "data-force": k } : {}
|
|
197
210
|
}, e.key);
|
|
198
211
|
return /* @__PURE__ */ C("div", {
|
|
199
212
|
ref: (e) => {
|
|
200
|
-
|
|
213
|
+
U.current = e, typeof A == "function" ? A(e) : A && (A.current = e);
|
|
201
214
|
},
|
|
202
215
|
role: "grid",
|
|
203
216
|
"aria-label": ee,
|
|
204
|
-
"aria-rowcount":
|
|
217
|
+
"aria-rowcount": K.length || void 0,
|
|
205
218
|
"aria-multiselectable": a || void 0,
|
|
206
219
|
"aria-busy": T || void 0,
|
|
207
220
|
onKeyDown: (e) => {
|
|
208
|
-
|
|
221
|
+
J(), xe(e);
|
|
222
|
+
},
|
|
223
|
+
onPointerEnter: J,
|
|
224
|
+
onPointerDown: J,
|
|
225
|
+
onFocus: (e) => {
|
|
226
|
+
if (J(), !e.currentTarget.contains(e.target)) return;
|
|
227
|
+
let t = Number(e.target.closest("[role=row]")?.querySelector("[data-index]")?.dataset.index), n = K[t];
|
|
228
|
+
Z.current = n ? {
|
|
229
|
+
key: n.key,
|
|
230
|
+
index: t
|
|
231
|
+
} : null;
|
|
209
232
|
},
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
onWheel:
|
|
233
|
+
onBlur: (e) => {
|
|
234
|
+
e.currentTarget.contains(e.target) && !e.relatedTarget && (Z.current = null);
|
|
235
|
+
},
|
|
236
|
+
onWheel: J,
|
|
214
237
|
className: e("relative flex flex-col outline-none", te && "overflow-hidden rounded-group bg-raised shadow-xs", D),
|
|
215
|
-
children: [T && (
|
|
238
|
+
children: [T && (fe || K.length === 0) ? /* @__PURE__ */ S(oe, {
|
|
216
239
|
density: d,
|
|
217
240
|
grouped: !!r
|
|
218
|
-
}) :
|
|
241
|
+
}) : fe && E ? /* @__PURE__ */ S("div", {
|
|
219
242
|
role: "row",
|
|
220
243
|
children: /* @__PURE__ */ S("div", {
|
|
221
244
|
role: "gridcell",
|
|
222
245
|
children: E
|
|
223
246
|
})
|
|
224
|
-
}) :
|
|
225
|
-
count:
|
|
226
|
-
estimateSize:
|
|
227
|
-
getScrollElement: () => p(
|
|
228
|
-
scrollTo:
|
|
229
|
-
row: (e) => $(
|
|
230
|
-
measure:
|
|
231
|
-
}) :
|
|
232
|
-
count:
|
|
233
|
-
estimateSize:
|
|
234
|
-
row: (e) => $(
|
|
235
|
-
}) :
|
|
236
|
-
ref:
|
|
237
|
-
count:
|
|
238
|
-
onClear: () =>
|
|
247
|
+
}) : q && Y ? /* @__PURE__ */ S(Y, {
|
|
248
|
+
count: K.length,
|
|
249
|
+
estimateSize: me,
|
|
250
|
+
getScrollElement: () => p(U.current),
|
|
251
|
+
scrollTo: ge,
|
|
252
|
+
row: (e) => $(K[e], e),
|
|
253
|
+
measure: G
|
|
254
|
+
}) : q ? /* @__PURE__ */ S(ae, {
|
|
255
|
+
count: K.length,
|
|
256
|
+
estimateSize: me,
|
|
257
|
+
row: (e) => $(K[e], e)
|
|
258
|
+
}) : K.map($), a && Q && w && /* @__PURE__ */ S(R, {
|
|
259
|
+
ref: W,
|
|
260
|
+
count: F.size,
|
|
261
|
+
onClear: () => z(/* @__PURE__ */ new Set()),
|
|
239
262
|
children: _
|
|
240
263
|
})]
|
|
241
264
|
});
|
|
242
265
|
});
|
|
243
|
-
process.env.NODE_ENV !== "production" && (
|
|
244
|
-
function
|
|
266
|
+
process.env.NODE_ENV !== "production" && (P.displayName = "List");
|
|
267
|
+
function re(e, t) {
|
|
245
268
|
return t ? e ? "bg-raised-pressed controls-on-fill hover:raised-selected-hover active:raised-selected-hover" : "bg-fill-2 controls-on-fill hover:bg-fill-3 active:bg-fill-3" : e ? "hover:bg-raised-hover hover:controls-on-fill active:bg-raised-pressed" : "hover:bg-fill-1 hover:controls-on-fill active:bg-fill-2";
|
|
246
269
|
}
|
|
247
|
-
function
|
|
270
|
+
function F(e) {
|
|
248
271
|
let t = typeof window > "u" ? null : window.getSelection();
|
|
249
272
|
return !!t && !t.isCollapsed && !!t.anchorNode && e.contains(t.anchorNode);
|
|
250
273
|
}
|
|
251
|
-
function
|
|
274
|
+
function ie(e, t) {
|
|
252
275
|
let n = t?.firstElementChild?.getBoundingClientRect().top;
|
|
253
276
|
if (n === void 0) return;
|
|
254
277
|
let r = e.getBoundingClientRect().bottom + 8 - n;
|
|
255
278
|
r > 0 && p(e)?.scrollBy({ top: r });
|
|
256
279
|
}
|
|
257
|
-
function
|
|
280
|
+
function ae({ count: e, estimateSize: t, row: n }) {
|
|
258
281
|
let r = typeof window > "u" ? 1024 : window.innerHeight, i = [], a = 0, o = 12;
|
|
259
282
|
for (let s = 0; s < e; s++) {
|
|
260
283
|
if (a >= r && o-- <= 0) {
|
|
@@ -275,7 +298,7 @@ function ie({ count: e, estimateSize: t, row: n }) {
|
|
|
275
298
|
children: i
|
|
276
299
|
});
|
|
277
300
|
}
|
|
278
|
-
function
|
|
301
|
+
function oe({ density: t, grouped: n }) {
|
|
279
302
|
let i = r();
|
|
280
303
|
return /* @__PURE__ */ C("div", {
|
|
281
304
|
role: "presentation",
|
|
@@ -317,7 +340,7 @@ function ae({ density: t, grouped: n }) {
|
|
|
317
340
|
}, r))]
|
|
318
341
|
});
|
|
319
342
|
}
|
|
320
|
-
var
|
|
343
|
+
var I = /* @__PURE__ */ h(function({ item: t, index: a, depth: o = 0, lastChild: s, idWidth: l, density: u = "default", wrapSubtitle: d = !1, narrow: p = !1, active: m, selected: h, selectable: g, selecting: _, onSelect: v, onOpen: y, onFocus: b, "data-force": x }, w) {
|
|
321
344
|
let T = n(), E = r(), D = i(), O = p && !!(t.meta || t.date), A = (T || O) && !!t.subtitle, j = A && d, M = !!t.disabled, N = t.avatar && /* @__PURE__ */ S("span", {
|
|
322
345
|
className: e("flex shrink-0", M && "opacity-50"),
|
|
323
346
|
children: t.avatar
|
|
@@ -336,10 +359,10 @@ var L = /* @__PURE__ */ h(function({ item: t, index: a, depth: o = 0, lastChild:
|
|
|
336
359
|
tabIndex: m === !1 ? -1 : 0,
|
|
337
360
|
onFocus: b,
|
|
338
361
|
onClick: (e) => {
|
|
339
|
-
e.currentTarget.contains(e.target) && !e.target.closest("button, a, [role=checkbox]") && (
|
|
362
|
+
e.currentTarget.contains(e.target) && !e.target.closest("button, a, [role=checkbox]") && (F(e.currentTarget) || (_ && g ? v?.() : y?.()));
|
|
340
363
|
},
|
|
341
364
|
...x ? { "data-force": x } : {},
|
|
342
|
-
className: e("group/row relative flex cursor-pointer items-center gap-12 text-body transition-control focus-ring-inset", T ? "rounded-none px-20" : "rounded-item px-12", A || O || j ? "min-h-56 py-8" : T && u === "default" ? "h-48" : k.density[u].classes,
|
|
365
|
+
className: e("group/row relative flex cursor-pointer items-center gap-12 text-body transition-control focus-ring-inset", T ? "rounded-none px-20" : "rounded-item px-12", A || O || j ? "min-h-56 py-8" : T && u === "default" ? "h-48" : k.density[u].classes, re(T, !!h), M && "pointer-events-none text-fg-disabled"),
|
|
343
366
|
children: [
|
|
344
367
|
g && /* @__PURE__ */ S("span", {
|
|
345
368
|
className: e("flex shrink-0 transition-control select-none", _ || h ? "opacity-100" : "opacity-0 group-hover/row:opacity-100 group-focus-visible/row:opacity-100 coarse:opacity-100"),
|
|
@@ -386,10 +409,10 @@ var L = /* @__PURE__ */ h(function({ item: t, index: a, depth: o = 0, lastChild:
|
|
|
386
409
|
children: t.subtitle
|
|
387
410
|
})]
|
|
388
411
|
}), O && /* @__PURE__ */ C("span", {
|
|
389
|
-
className: "flex h-24 min-w-0 items-center gap-8",
|
|
412
|
+
className: "flex min-h-24 min-w-0 flex-wrap items-center gap-x-8",
|
|
390
413
|
children: [
|
|
391
414
|
t.meta && /* @__PURE__ */ S("span", {
|
|
392
|
-
className: e("flex min-w-0 items-center gap-6 overflow-hidden", M && "opacity-50"),
|
|
415
|
+
className: e("flex min-w-0 max-w-full items-center gap-6 overflow-hidden", M && "opacity-50"),
|
|
393
416
|
children: t.meta
|
|
394
417
|
}),
|
|
395
418
|
t.date && /* @__PURE__ */ S("span", {
|
|
@@ -423,8 +446,8 @@ var L = /* @__PURE__ */ h(function({ item: t, index: a, depth: o = 0, lastChild:
|
|
|
423
446
|
})
|
|
424
447
|
});
|
|
425
448
|
});
|
|
426
|
-
process.env.NODE_ENV !== "production" && (
|
|
427
|
-
var
|
|
449
|
+
process.env.NODE_ENV !== "production" && (I.displayName = "ListRow");
|
|
450
|
+
var L = /* @__PURE__ */ h(function({ title: t, glyph: a, count: o, collapsed: s, onToggle: c, onAdd: u, addLabel: d, indent: f, first: p, index: m, active: h, onFocus: g }, _) {
|
|
428
451
|
let v = n(), y = r(), b = i();
|
|
429
452
|
return /* @__PURE__ */ S("div", {
|
|
430
453
|
ref: _,
|
|
@@ -485,8 +508,8 @@ var R = /* @__PURE__ */ h(function({ title: t, glyph: a, count: o, collapsed: s,
|
|
|
485
508
|
})
|
|
486
509
|
});
|
|
487
510
|
});
|
|
488
|
-
process.env.NODE_ENV !== "production" && (
|
|
489
|
-
var
|
|
511
|
+
process.env.NODE_ENV !== "production" && (L.displayName = "GroupHeader");
|
|
512
|
+
var R = /* @__PURE__ */ h(function({ count: e, onClear: n, children: r }, o) {
|
|
490
513
|
let s = t(), c = i();
|
|
491
514
|
return typeof document > "u" ? null : E(/* @__PURE__ */ S("div", {
|
|
492
515
|
ref: o,
|
|
@@ -519,8 +542,8 @@ var z = /* @__PURE__ */ h(function({ count: e, onClear: n, children: r }, o) {
|
|
|
519
542
|
})
|
|
520
543
|
}), s ?? document.body);
|
|
521
544
|
});
|
|
522
|
-
process.env.NODE_ENV !== "production" && (
|
|
523
|
-
var
|
|
545
|
+
process.env.NODE_ENV !== "production" && (R.displayName = "SelectionBar");
|
|
546
|
+
var z = /* @__PURE__ */ h(function({ children: t, onClick: n, icon: r, danger: i }, o) {
|
|
524
547
|
return /* @__PURE__ */ C("button", {
|
|
525
548
|
ref: o,
|
|
526
549
|
type: "button",
|
|
@@ -533,8 +556,8 @@ var B = /* @__PURE__ */ h(function({ children: t, onClick: n, icon: r, danger: i
|
|
|
533
556
|
}), t]
|
|
534
557
|
});
|
|
535
558
|
});
|
|
536
|
-
process.env.NODE_ENV !== "production" && (
|
|
559
|
+
process.env.NODE_ENV !== "production" && (z.displayName = "SelectionAction");
|
|
537
560
|
//#endregion
|
|
538
|
-
export {
|
|
561
|
+
export { I as a, P as i, A as n, z as o, k as r, R as s, L as t };
|
|
539
562
|
|
|
540
|
-
//# sourceMappingURL=list-
|
|
563
|
+
//# sourceMappingURL=list-o8wcuBOz.js.map
|