@yamada-ui/react 2.2.9 → 2.2.10-dev-20261007040639

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 (35) hide show
  1. package/dist/cjs/components/chart/cartesian-chart.cjs +3 -2
  2. package/dist/cjs/components/chart/cartesian-chart.cjs.map +1 -1
  3. package/dist/cjs/components/chart/cartesian-chart.style.cjs +2 -2
  4. package/dist/cjs/components/chart/cartesian-chart.style.cjs.map +1 -1
  5. package/dist/cjs/components/chart/polar-chart.cjs +3 -2
  6. package/dist/cjs/components/chart/polar-chart.cjs.map +1 -1
  7. package/dist/cjs/components/chart/polar-chart.style.cjs +2 -2
  8. package/dist/cjs/components/chart/polar-chart.style.cjs.map +1 -1
  9. package/dist/cjs/components/group/use-group.cjs.map +1 -1
  10. package/dist/cjs/hooks/use-animation/index.cjs +3 -3
  11. package/dist/cjs/hooks/use-animation/index.cjs.map +1 -1
  12. package/dist/cjs/hooks/use-clickable/index.cjs.map +1 -1
  13. package/dist/cjs/hooks/use-pan-event/index.cjs.map +1 -1
  14. package/dist/esm/components/chart/cartesian-chart.js +3 -2
  15. package/dist/esm/components/chart/cartesian-chart.js.map +1 -1
  16. package/dist/esm/components/chart/cartesian-chart.style.js +2 -2
  17. package/dist/esm/components/chart/cartesian-chart.style.js.map +1 -1
  18. package/dist/esm/components/chart/polar-chart.js +3 -2
  19. package/dist/esm/components/chart/polar-chart.js.map +1 -1
  20. package/dist/esm/components/chart/polar-chart.style.js +2 -2
  21. package/dist/esm/components/chart/polar-chart.style.js.map +1 -1
  22. package/dist/esm/components/group/use-group.js.map +1 -1
  23. package/dist/esm/hooks/use-animation/index.js +3 -3
  24. package/dist/esm/hooks/use-animation/index.js.map +1 -1
  25. package/dist/esm/hooks/use-clickable/index.js.map +1 -1
  26. package/dist/esm/hooks/use-pan-event/index.js.map +1 -1
  27. package/dist/types/components/chart/cartesian-chart.style.d.ts +1 -1
  28. package/dist/types/components/chart/polar-chart.style.d.ts +1 -1
  29. package/dist/types/components/group/index.d.ts +2 -2
  30. package/dist/types/components/group/use-group.d.ts +2 -2
  31. package/dist/types/hooks/use-animation/index.d.ts +6 -5
  32. package/dist/types/hooks/use-clickable/index.d.ts +3 -3
  33. package/dist/types/hooks/use-pan-event/index.d.ts +3 -3
  34. package/dist/types/index.d.ts +6 -6
  35. package/package.json +1 -1
@@ -97,7 +97,7 @@ const polarChartStyle = defineComponentSlotStyle({ base: {
97
97
  },
98
98
  root: {
99
99
  "--active-dot-fill": "{radar-color}",
100
- "--active-dot-r": "4",
100
+ "--active-dot-r": "4px",
101
101
  "--active-dot-stroke": "{radar-color}",
102
102
  "--active-dot-stroke-width": "0",
103
103
  "--angle-axis-line-stroke": "currentColor",
@@ -105,7 +105,7 @@ const polarChartStyle = defineComponentSlotStyle({ base: {
105
105
  "--angle-axis-text-color": "colors.fg.muted",
106
106
  "--angle-axis-text-fill": "currentColor",
107
107
  "--dot-fill": "{radar-stroke}",
108
- "--dot-r": "4",
108
+ "--dot-r": "4px",
109
109
  "--dot-stroke": "{radar-stroke}",
110
110
  "--dot-stroke-width": "0",
111
111
  "--grid-stroke": "colors.border",
@@ -1 +1 @@
1
- {"version":3,"file":"polar-chart.style.js","names":[],"sources":["../../../../src/components/chart/polar-chart.style.ts"],"sourcesContent":["import { defineComponentSlotStyle } from \"../../core\"\n\nexport const polarChartStyle = defineComponentSlotStyle({\n base: {\n activeDot: {\n fill: \"{active-dot-fill}\",\n r: \"{active-dot-r}\",\n stroke: \"{active-dot-stroke}\",\n strokeWidth: \"{active-dot-stroke-width}\",\n },\n angleAxis: {},\n angleAxisLabel: {\n color: \"{angle-axis-text-color}\",\n fill: \"{angle-axis-text-fill}\",\n fontSize: \"xs\",\n fontWeight: \"medium\",\n },\n angleAxisLine: {\n color: \"{angle-axis-text-color}\",\n fill: \"transparent\",\n stroke: \"{angle-axis-line-stroke}\",\n strokeWidth: \"{angle-axis-line-stroke-width}\",\n },\n angleAxisTick: {\n color: \"{angle-axis-text-color}\",\n fill: \"{angle-axis-text-fill}\",\n fontSize: \"xs\",\n fontWeight: \"medium\",\n },\n angleAxisTickLine: {\n color: \"{angle-axis-text-color}\",\n stroke: \"{angle-axis-line-stroke}\",\n strokeWidth: \"{angle-axis-line-stroke-width}\",\n },\n dot: {\n fill: \"{dot-fill}\",\n r: \"{dot-r}\",\n stroke: \"{dot-stroke}\",\n strokeWidth: \"{dot-stroke-width}\",\n },\n grid: { stroke: \"{grid-stroke}\" },\n label: {\n _inactive: { opacity: \"{inactive-label-opacity}\" },\n color: \"{label-color}\",\n fill: \"{label-fill}\",\n fontSize: \"xs\",\n fontWeight: \"medium\",\n },\n labelLine: {\n _inactive: { opacity: \"{inactive-label-line-opacity}\" },\n stroke: \"{label-line-stroke}\",\n strokeWidth: \"{label-line-stroke-width}\",\n },\n labelList: {\n color: \"{label-color}\",\n fill: \"{label-fill}\",\n fontSize: \"xs\",\n fontWeight: \"medium\",\n },\n pie: {},\n radar: {\n \"&:has(path[data-inactive])\": {\n opacity: \"{inactive-radar-opacity}\",\n },\n color: \"{radar-color}\",\n fill: \"{radar-stroke}\",\n fillOpacity: \"{radar-fill-opacity}\",\n stroke: \"{radar-stroke}\",\n strokeWidth: \"{radar-stroke-width}\",\n },\n radial: {},\n radialBackground: {\n color: \"{radial-background-color}\",\n fill: \"{radial-background-fill}\",\n stroke: \"{radial-background-stroke}\",\n strokeWidth: \"{radial-background-stroke-width}\",\n },\n radiusAxis: {},\n radiusAxisLabel: {\n color: \"{radius-axis-text-color}\",\n fill: \"{radius-axis-text-fill}\",\n fontSize: \"xs\",\n fontWeight: \"medium\",\n },\n radiusAxisLine: {\n color: \"{radius-axis-text-color}\",\n stroke: \"{radius-axis-line-stroke}\",\n strokeWidth: \"{radius-axis-line-stroke-width}\",\n },\n radiusAxisTick: {\n color: \"{radius-axis-text-color}\",\n fill: \"{radius-axis-text-fill}\",\n fontSize: \"xs\",\n fontWeight: \"medium\",\n },\n radiusAxisTickLine: {\n color: \"{radius-axis-text-color}\",\n stroke: \"{radius-axis-line-stroke}\",\n strokeWidth: \"{radius-axis-line-stroke-width}\",\n },\n root: {\n \"--active-dot-fill\": \"{radar-color}\",\n \"--active-dot-r\": \"4\",\n \"--active-dot-stroke\": \"{radar-color}\",\n \"--active-dot-stroke-width\": \"0\",\n \"--angle-axis-line-stroke\": \"currentColor\",\n \"--angle-axis-line-stroke-width\": \"1\",\n \"--angle-axis-text-color\": \"colors.fg.muted\",\n \"--angle-axis-text-fill\": \"currentColor\",\n \"--dot-fill\": \"{radar-stroke}\",\n \"--dot-r\": \"4\",\n \"--dot-stroke\": \"{radar-stroke}\",\n \"--dot-stroke-width\": \"0\",\n \"--grid-stroke\": \"colors.border\",\n \"--inactive-label-line-opacity\": \"0.4\",\n \"--inactive-label-opacity\": \"0.4\",\n \"--inactive-radar-opacity\": \"0.4\",\n \"--inactive-sector-opacity\": \"0.4\",\n \"--label-color\": \"colors.fg.muted\",\n \"--label-fill\": \"currentColor\",\n \"--label-line-stroke\": \"colors.fg.muted\",\n \"--label-line-stroke-width\": \"1\",\n \"--radar-color\": \"colorScheme.solid\",\n \"--radar-fill-opacity\": \"0.4\",\n \"--radar-stroke\": \"currentColor\",\n \"--radar-stroke-width\": \"2\",\n \"--radial-background-color\": \"colors.bg.subtle\",\n \"--radial-background-fill\": \"currentColor\",\n \"--radial-background-stroke\": \"currentColor\",\n \"--radial-background-stroke-width\": \"0\",\n \"--radius-axis-line-stroke\": \"colors.border\",\n \"--radius-axis-line-stroke-width\": \"1\",\n \"--radius-axis-text-color\": \"colors.fg.muted\",\n \"--radius-axis-text-fill\": \"currentColor\",\n \"--sector-color\": \"colorScheme.solid\",\n \"--sector-fill\": \"currentColor\",\n \"--sector-stroke\": \"colors.bg\",\n \"--sector-stroke-width\": \"2\",\n },\n sector: {\n _inactive: { opacity: \"{inactive-sector-opacity}\" },\n color: \"{sector-color}\",\n fill: \"{sector-fill}\",\n stroke: \"{sector-stroke}\",\n strokeWidth: \"{sector-stroke-width}\",\n },\n },\n})\n\nexport type PolarChartStyle = typeof polarChartStyle\n"],"mappings":";;AAEA,MAAa,kBAAkB,yBAAyB,EACtD,MAAM;CACJ,WAAW;EACT,MAAM;EACN,GAAG;EACH,QAAQ;EACR,aAAa;CACf;CACA,WAAW,CAAC;CACZ,gBAAgB;EACd,OAAO;EACP,MAAM;EACN,UAAU;EACV,YAAY;CACd;CACA,eAAe;EACb,OAAO;EACP,MAAM;EACN,QAAQ;EACR,aAAa;CACf;CACA,eAAe;EACb,OAAO;EACP,MAAM;EACN,UAAU;EACV,YAAY;CACd;CACA,mBAAmB;EACjB,OAAO;EACP,QAAQ;EACR,aAAa;CACf;CACA,KAAK;EACH,MAAM;EACN,GAAG;EACH,QAAQ;EACR,aAAa;CACf;CACA,MAAM,EAAE,QAAQ,gBAAgB;CAChC,OAAO;EACL,WAAW,EAAE,SAAS,2BAA2B;EACjD,OAAO;EACP,MAAM;EACN,UAAU;EACV,YAAY;CACd;CACA,WAAW;EACT,WAAW,EAAE,SAAS,gCAAgC;EACtD,QAAQ;EACR,aAAa;CACf;CACA,WAAW;EACT,OAAO;EACP,MAAM;EACN,UAAU;EACV,YAAY;CACd;CACA,KAAK,CAAC;CACN,OAAO;EACL,8BAA8B,EAC5B,SAAS,2BACX;EACA,OAAO;EACP,MAAM;EACN,aAAa;EACb,QAAQ;EACR,aAAa;CACf;CACA,QAAQ,CAAC;CACT,kBAAkB;EAChB,OAAO;EACP,MAAM;EACN,QAAQ;EACR,aAAa;CACf;CACA,YAAY,CAAC;CACb,iBAAiB;EACf,OAAO;EACP,MAAM;EACN,UAAU;EACV,YAAY;CACd;CACA,gBAAgB;EACd,OAAO;EACP,QAAQ;EACR,aAAa;CACf;CACA,gBAAgB;EACd,OAAO;EACP,MAAM;EACN,UAAU;EACV,YAAY;CACd;CACA,oBAAoB;EAClB,OAAO;EACP,QAAQ;EACR,aAAa;CACf;CACA,MAAM;EACJ,qBAAqB;EACrB,kBAAkB;EAClB,uBAAuB;EACvB,6BAA6B;EAC7B,4BAA4B;EAC5B,kCAAkC;EAClC,2BAA2B;EAC3B,0BAA0B;EAC1B,cAAc;EACd,WAAW;EACX,gBAAgB;EAChB,sBAAsB;EACtB,iBAAiB;EACjB,iCAAiC;EACjC,4BAA4B;EAC5B,4BAA4B;EAC5B,6BAA6B;EAC7B,iBAAiB;EACjB,gBAAgB;EAChB,uBAAuB;EACvB,6BAA6B;EAC7B,iBAAiB;EACjB,wBAAwB;EACxB,kBAAkB;EAClB,wBAAwB;EACxB,6BAA6B;EAC7B,4BAA4B;EAC5B,8BAA8B;EAC9B,oCAAoC;EACpC,6BAA6B;EAC7B,mCAAmC;EACnC,4BAA4B;EAC5B,2BAA2B;EAC3B,kBAAkB;EAClB,iBAAiB;EACjB,mBAAmB;EACnB,yBAAyB;CAC3B;CACA,QAAQ;EACN,WAAW,EAAE,SAAS,4BAA4B;EAClD,OAAO;EACP,MAAM;EACN,QAAQ;EACR,aAAa;CACf;AACF,EACF,CAAC"}
1
+ {"version":3,"file":"polar-chart.style.js","names":[],"sources":["../../../../src/components/chart/polar-chart.style.ts"],"sourcesContent":["import { defineComponentSlotStyle } from \"../../core\"\n\nexport const polarChartStyle = defineComponentSlotStyle({\n base: {\n activeDot: {\n fill: \"{active-dot-fill}\",\n r: \"{active-dot-r}\",\n stroke: \"{active-dot-stroke}\",\n strokeWidth: \"{active-dot-stroke-width}\",\n },\n angleAxis: {},\n angleAxisLabel: {\n color: \"{angle-axis-text-color}\",\n fill: \"{angle-axis-text-fill}\",\n fontSize: \"xs\",\n fontWeight: \"medium\",\n },\n angleAxisLine: {\n color: \"{angle-axis-text-color}\",\n fill: \"transparent\",\n stroke: \"{angle-axis-line-stroke}\",\n strokeWidth: \"{angle-axis-line-stroke-width}\",\n },\n angleAxisTick: {\n color: \"{angle-axis-text-color}\",\n fill: \"{angle-axis-text-fill}\",\n fontSize: \"xs\",\n fontWeight: \"medium\",\n },\n angleAxisTickLine: {\n color: \"{angle-axis-text-color}\",\n stroke: \"{angle-axis-line-stroke}\",\n strokeWidth: \"{angle-axis-line-stroke-width}\",\n },\n dot: {\n fill: \"{dot-fill}\",\n r: \"{dot-r}\",\n stroke: \"{dot-stroke}\",\n strokeWidth: \"{dot-stroke-width}\",\n },\n grid: { stroke: \"{grid-stroke}\" },\n label: {\n _inactive: { opacity: \"{inactive-label-opacity}\" },\n color: \"{label-color}\",\n fill: \"{label-fill}\",\n fontSize: \"xs\",\n fontWeight: \"medium\",\n },\n labelLine: {\n _inactive: { opacity: \"{inactive-label-line-opacity}\" },\n stroke: \"{label-line-stroke}\",\n strokeWidth: \"{label-line-stroke-width}\",\n },\n labelList: {\n color: \"{label-color}\",\n fill: \"{label-fill}\",\n fontSize: \"xs\",\n fontWeight: \"medium\",\n },\n pie: {},\n radar: {\n \"&:has(path[data-inactive])\": {\n opacity: \"{inactive-radar-opacity}\",\n },\n color: \"{radar-color}\",\n fill: \"{radar-stroke}\",\n fillOpacity: \"{radar-fill-opacity}\",\n stroke: \"{radar-stroke}\",\n strokeWidth: \"{radar-stroke-width}\",\n },\n radial: {},\n radialBackground: {\n color: \"{radial-background-color}\",\n fill: \"{radial-background-fill}\",\n stroke: \"{radial-background-stroke}\",\n strokeWidth: \"{radial-background-stroke-width}\",\n },\n radiusAxis: {},\n radiusAxisLabel: {\n color: \"{radius-axis-text-color}\",\n fill: \"{radius-axis-text-fill}\",\n fontSize: \"xs\",\n fontWeight: \"medium\",\n },\n radiusAxisLine: {\n color: \"{radius-axis-text-color}\",\n stroke: \"{radius-axis-line-stroke}\",\n strokeWidth: \"{radius-axis-line-stroke-width}\",\n },\n radiusAxisTick: {\n color: \"{radius-axis-text-color}\",\n fill: \"{radius-axis-text-fill}\",\n fontSize: \"xs\",\n fontWeight: \"medium\",\n },\n radiusAxisTickLine: {\n color: \"{radius-axis-text-color}\",\n stroke: \"{radius-axis-line-stroke}\",\n strokeWidth: \"{radius-axis-line-stroke-width}\",\n },\n root: {\n \"--active-dot-fill\": \"{radar-color}\",\n \"--active-dot-r\": \"4px\",\n \"--active-dot-stroke\": \"{radar-color}\",\n \"--active-dot-stroke-width\": \"0\",\n \"--angle-axis-line-stroke\": \"currentColor\",\n \"--angle-axis-line-stroke-width\": \"1\",\n \"--angle-axis-text-color\": \"colors.fg.muted\",\n \"--angle-axis-text-fill\": \"currentColor\",\n \"--dot-fill\": \"{radar-stroke}\",\n \"--dot-r\": \"4px\",\n \"--dot-stroke\": \"{radar-stroke}\",\n \"--dot-stroke-width\": \"0\",\n \"--grid-stroke\": \"colors.border\",\n \"--inactive-label-line-opacity\": \"0.4\",\n \"--inactive-label-opacity\": \"0.4\",\n \"--inactive-radar-opacity\": \"0.4\",\n \"--inactive-sector-opacity\": \"0.4\",\n \"--label-color\": \"colors.fg.muted\",\n \"--label-fill\": \"currentColor\",\n \"--label-line-stroke\": \"colors.fg.muted\",\n \"--label-line-stroke-width\": \"1\",\n \"--radar-color\": \"colorScheme.solid\",\n \"--radar-fill-opacity\": \"0.4\",\n \"--radar-stroke\": \"currentColor\",\n \"--radar-stroke-width\": \"2\",\n \"--radial-background-color\": \"colors.bg.subtle\",\n \"--radial-background-fill\": \"currentColor\",\n \"--radial-background-stroke\": \"currentColor\",\n \"--radial-background-stroke-width\": \"0\",\n \"--radius-axis-line-stroke\": \"colors.border\",\n \"--radius-axis-line-stroke-width\": \"1\",\n \"--radius-axis-text-color\": \"colors.fg.muted\",\n \"--radius-axis-text-fill\": \"currentColor\",\n \"--sector-color\": \"colorScheme.solid\",\n \"--sector-fill\": \"currentColor\",\n \"--sector-stroke\": \"colors.bg\",\n \"--sector-stroke-width\": \"2\",\n },\n sector: {\n _inactive: { opacity: \"{inactive-sector-opacity}\" },\n color: \"{sector-color}\",\n fill: \"{sector-fill}\",\n stroke: \"{sector-stroke}\",\n strokeWidth: \"{sector-stroke-width}\",\n },\n },\n})\n\nexport type PolarChartStyle = typeof polarChartStyle\n"],"mappings":";;AAEA,MAAa,kBAAkB,yBAAy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EACd,WAAW;EACX,gBAAgB;EAChB,sBAAsB;EACtB,iBAAiB;EACjB,iCAAiC;EACjC,4BAA4B;EAC5B,4BAA4B;EAC5B,6BAA6B;EAC7B,iBAAiB;EACjB,gBAAgB;EAChB,uBAAuB;EACvB,6BAA6B;EAC7B,iBAAiB;EACjB,wBAAwB;EACxB,kBAAkB;EAClB,wBAAwB;EACxB,6BAA6B;EAC7B,4BAA4B;EAC5B,8BAA8B;EAC9B,oCAAoC;EACpC,6BAA6B;EAC7B,mCAAmC;EACnC,4BAA4B;EAC5B,2BAA2B;EAC3B,kBAAkB;EAClB,iBAAiB;EACjB,mBAAmB;EACnB,yBAAyB;CAC3B;CACA,QAAQ;EACN,WAAW,EAAE,SAAS,4BAA4B;EAClD,OAAO;EACP,MAAM;EACN,QAAQ;EACR,aAAa;CACf;AACF,EACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-group.js","names":["isUndefined","isNull","dataAttr"],"sources":["../../../../src/components/group/use-group.ts"],"sourcesContent":["import type { CSSProperties, DataAttributes, ReactNode } from \"react\"\nimport { cloneElement, useMemo } from \"react\"\nimport { dataAttr, isNull, isUndefined, useValidChildren } from \"../../utils\"\n\nexport const useGroup = (children?: ReactNode) => {\n const validChildren = useValidChildren(children)\n const omittedChildren = useMemo(\n () =>\n validChildren.filter((child) => {\n const ungrouped = child.props[\"data-ungrouped\"]\n\n return isUndefined(ungrouped) || isNull(ungrouped)\n }),\n [validChildren],\n )\n const count = omittedChildren.length\n const cloneChildren = useMemo(\n () =>\n validChildren.map((child) => {\n const index = omittedChildren.indexOf(child)\n const ungrouped = index === -1\n\n if (ungrouped) return child\n\n return cloneElement(child, {\n ...child.props,\n style: {\n \"--group-count\": count,\n \"--group-index\": index,\n ...child.props?.style,\n },\n \"data-group-between\": dataAttr(index > 0 && index < count - 1),\n \"data-group-end\": dataAttr(index === count - 1),\n \"data-group-start\": dataAttr(index === 0),\n \"data-peer\": \"\",\n })\n }),\n [validChildren, omittedChildren, count],\n )\n\n return cloneChildren\n}\n\nexport type UseGroupReturn = ReturnType<typeof useGroup>\n\ninterface Props extends DataAttributes {\n style?: CSSProperties\n}\n\nexport const useGroupItemProps = <Y extends Props>({\n style: {\n \"--group-count\": groupCount,\n \"--group-index\": groupIndex,\n ...style\n } = {},\n \"data-group-between\": dataGroupBetween,\n \"data-group-end\": dataGroupEnd,\n \"data-group-start\": dataGroupStart,\n \"data-peer\": dataPeer,\n ...rest\n}: Y) => {\n const pickedProps = useMemo(\n () => ({\n style: {\n \"--group-count\": groupCount!,\n \"--group-index\": groupIndex!,\n },\n \"data-group-between\": dataGroupBetween,\n \"data-group-end\": dataGroupEnd,\n \"data-group-start\": dataGroupStart,\n \"data-peer\": dataPeer,\n }),\n [\n groupCount,\n groupIndex,\n dataGroupBetween,\n dataGroupEnd,\n dataGroupStart,\n dataPeer,\n ],\n )\n const omittedProps = useMemo(() => ({ style, ...rest }), [style, rest])\n\n return [pickedProps, omittedProps] as const\n}\n\nexport type UseGroupItemReturn = ReturnType<typeof useGroupItemProps>\n"],"mappings":";;;;AAIA,MAAa,YAAY,aAAyB;CAChD,MAAM,gBAAgB,iBAAiB,QAAQ;CAC/C,MAAM,kBAAkB,cAEpB,cAAc,QAAQ,UAAU;EAC9B,MAAM,YAAY,MAAM,MAAM;EAE9B,QAAA,GAAOA,cAAAA,YAAAA,CAAY,SAAS,MAAA,GAAKC,cAAAA,OAAAA,CAAO,SAAS;CACnD,CAAC,GACH,CAAC,aAAa,CAChB;CACA,MAAM,QAAQ,gBAAgB;CAyB9B,OAxBsB,cAElB,cAAc,KAAK,UAAU;EAC3B,MAAM,QAAQ,gBAAgB,QAAQ,KAAK;EAG3C,IAFkB,UAAU,IAEb,OAAO;EAEtB,OAAO,aAAa,OAAO;GACzB,GAAG,MAAM;GACT,OAAO;IACL,iBAAiB;IACjB,iBAAiB;IACjB,GAAG,MAAM,OAAO;GAClB;GACA,uBAAA,GAAsBC,cAAAA,SAAAA,CAAS,QAAQ,KAAK,QAAQ,QAAQ,CAAC;GAC7D,mBAAA,GAAkBA,cAAAA,SAAAA,CAAS,UAAU,QAAQ,CAAC;GAC9C,qBAAA,GAAoBA,cAAAA,SAAAA,CAAS,UAAU,CAAC;GACxC,aAAa;EACf,CAAC;CACH,CAAC,GACH;EAAC;EAAe;EAAiB;CAAK,CAGrB;AACrB;AAQA,MAAa,qBAAsC,EACjD,OAAO,EACL,iBAAiB,YACjB,iBAAiB,YACjB,GAAG,UACD,CAAC,GACL,sBAAsB,kBACtB,kBAAkB,cAClB,oBAAoB,gBACpB,aAAa,UACb,GAAG,WACI;CAuBP,OAAO,CAtBa,eACX;EACL,OAAO;GACL,iBAAiB;GACjB,iBAAiB;EACnB;EACA,sBAAsB;EACtB,kBAAkB;EAClB,oBAAoB;EACpB,aAAa;CACf,IACA;EACE;EACA;EACA;EACA;EACA;EACA;CACF,CAIgB,GAFG,eAAe;EAAE;EAAO,GAAG;CAAK,IAAI,CAAC,OAAO,IAAI,CAErC,CAAC;AACnC"}
1
+ {"version":3,"file":"use-group.js","names":["isUndefined","isNull","dataAttr"],"sources":["../../../../src/components/group/use-group.ts"],"sourcesContent":["import type { CSSProperties, DataAttributes, ReactNode } from \"react\"\nimport { cloneElement, useMemo } from \"react\"\nimport { dataAttr, isNull, isUndefined, useValidChildren } from \"../../utils\"\n\nexport const useGroup = (children?: ReactNode) => {\n const validChildren = useValidChildren(children)\n const omittedChildren = useMemo(\n () =>\n validChildren.filter((child) => {\n const ungrouped = child.props[\"data-ungrouped\"]\n\n return isUndefined(ungrouped) || isNull(ungrouped)\n }),\n [validChildren],\n )\n const count = omittedChildren.length\n const cloneChildren = useMemo(\n () =>\n validChildren.map((child) => {\n const index = omittedChildren.indexOf(child)\n const ungrouped = index === -1\n\n if (ungrouped) return child\n\n return cloneElement(child, {\n ...child.props,\n style: {\n \"--group-count\": count,\n \"--group-index\": index,\n ...child.props?.style,\n },\n \"data-group-between\": dataAttr(index > 0 && index < count - 1),\n \"data-group-end\": dataAttr(index === count - 1),\n \"data-group-start\": dataAttr(index === 0),\n \"data-peer\": \"\",\n })\n }),\n [validChildren, omittedChildren, count],\n )\n\n return cloneChildren\n}\n\nexport type UseGroupReturn = ReturnType<typeof useGroup>\n\nexport interface UseGroupItemProps extends DataAttributes {\n style?: CSSProperties\n}\n\nexport const useGroupItemProps = <Y extends UseGroupItemProps>({\n style: {\n \"--group-count\": groupCount,\n \"--group-index\": groupIndex,\n ...style\n } = {},\n \"data-group-between\": dataGroupBetween,\n \"data-group-end\": dataGroupEnd,\n \"data-group-start\": dataGroupStart,\n \"data-peer\": dataPeer,\n ...rest\n}: Y) => {\n const pickedProps = useMemo(\n () => ({\n style: {\n \"--group-count\": groupCount!,\n \"--group-index\": groupIndex!,\n },\n \"data-group-between\": dataGroupBetween,\n \"data-group-end\": dataGroupEnd,\n \"data-group-start\": dataGroupStart,\n \"data-peer\": dataPeer,\n }),\n [\n groupCount,\n groupIndex,\n dataGroupBetween,\n dataGroupEnd,\n dataGroupStart,\n dataPeer,\n ],\n )\n const omittedProps = useMemo(() => ({ style, ...rest }), [style, rest])\n\n return [pickedProps, omittedProps] as const\n}\n\nexport type UseGroupItemReturn = ReturnType<typeof useGroupItemProps>\n"],"mappings":";;;;AAIA,MAAa,YAAY,aAAyB;CAChD,MAAM,gBAAgB,iBAAiB,QAAQ;CAC/C,MAAM,kBAAkB,cAEpB,cAAc,QAAQ,UAAU;EAC9B,MAAM,YAAY,MAAM,MAAM;EAE9B,QAAA,GAAOA,cAAAA,YAAAA,CAAY,SAAS,MAAA,GAAKC,cAAAA,OAAAA,CAAO,SAAS;CACnD,CAAC,GACH,CAAC,aAAa,CAChB;CACA,MAAM,QAAQ,gBAAgB;CAyB9B,OAxBsB,cAElB,cAAc,KAAK,UAAU;EAC3B,MAAM,QAAQ,gBAAgB,QAAQ,KAAK;EAG3C,IAFkB,UAAU,IAEb,OAAO;EAEtB,OAAO,aAAa,OAAO;GACzB,GAAG,MAAM;GACT,OAAO;IACL,iBAAiB;IACjB,iBAAiB;IACjB,GAAG,MAAM,OAAO;GAClB;GACA,uBAAA,GAAsBC,cAAAA,SAAAA,CAAS,QAAQ,KAAK,QAAQ,QAAQ,CAAC;GAC7D,mBAAA,GAAkBA,cAAAA,SAAAA,CAAS,UAAU,QAAQ,CAAC;GAC9C,qBAAA,GAAoBA,cAAAA,SAAAA,CAAS,UAAU,CAAC;GACxC,aAAa;EACf,CAAC;CACH,CAAC,GACH;EAAC;EAAe;EAAiB;CAAK,CAGrB;AACrB;AAQA,MAAa,qBAAkD,EAC7D,OAAO,EACL,iBAAiB,YACjB,iBAAiB,YACjB,GAAG,UACD,CAAC,GACL,sBAAsB,kBACtB,kBAAkB,cAClB,oBAAoB,gBACpB,aAAa,UACb,GAAG,WACI;CAuBP,OAAO,CAtBa,eACX;EACL,OAAO;GACL,iBAAiB;GACjB,iBAAiB;EACnB;EACA,sBAAsB;EACtB,kBAAkB;EAClB,oBAAoB;EACpB,aAAa;CACf,IACA;EACE;EACA;EACA;EACA;EACA;EACA;CACF,CAIgB,GAFG,eAAe;EAAE;EAAO,GAAG;CAAK,IAAI,CAAC,OAAO,IAAI,CAErC,CAAC;AACnC"}
@@ -10,13 +10,13 @@ import { useCallback, useRef, useState } from "react";
10
10
  *
11
11
  * @see https://yamada-ui.com/docs/hooks/use-animation
12
12
  */
13
- const useAnimation = (cssObj) => {
13
+ const useAnimation = (arrayOrObj) => {
14
14
  const system = useSystem();
15
- if ((0, utils_exports.isArray)(cssObj)) return cssObj.map((cssObj) => animation(cssObj, {
15
+ if ((0, utils_exports.isArray)(arrayOrObj)) return arrayOrObj.map((obj) => animation(obj, {
16
16
  css,
17
17
  system
18
18
  })).join(", ");
19
- else return animation(cssObj, {
19
+ else return animation(arrayOrObj, {
20
20
  css,
21
21
  system
22
22
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["isArray","isUndefined","runIfFn"],"sources":["../../../../src/hooks/use-animation/index.ts"],"sourcesContent":["\"use client\"\n\nimport type { CSSAnimationObject, Token } from \"../../core\"\nimport { useCallback, useRef, useState } from \"react\"\nimport { animation, css, useSystem } from \"../../core\"\nimport { isArray, isUndefined, runIfFn } from \"../../utils\"\n\ntype CSSObject =\n | Token<CSSAnimationObject, \"animations\">\n | Token<CSSAnimationObject, \"animations\">[]\n\n/**\n * `useAnimation` is a custom hook that implements animations similar to CSS `keyframes`.\n *\n * @see https://yamada-ui.com/docs/hooks/use-animation\n */\nexport const useAnimation = (cssObj: CSSObject): string => {\n const system = useSystem()\n\n if (isArray(cssObj))\n return cssObj.map((cssObj) => animation(cssObj, { css, system })).join(\", \")\n else return animation(cssObj, { css, system })\n}\n\n/**\n * `useDynamicAnimation` is a custom hook used to switch animations.\n *\n * @see https://yamada-ui.com/docs/hooks/use-dynamic-animation\n */\nexport const useDynamicAnimation = <\n Y extends\n | Token<CSSAnimationObject, \"animations\">[]\n | { [key: string]: CSSObject },\n>(\n arrayOrObj: Y,\n init?: (keyof Y)[] | keyof Y,\n): [\n string | undefined,\n (\n key:\n | ((key: (keyof Y)[] | keyof Y | undefined) => (keyof Y)[] | keyof Y)\n | (keyof Y)[]\n | keyof Y,\n ) => void,\n] => {\n const system = useSystem()\n\n const keys = useRef<string | string[] | undefined>(\n !isUndefined(init)\n ? isArray(init)\n ? init.map(String)\n : String(init)\n : undefined,\n )\n const cache = useRef<Map<string, string>>(new Map<string, string>())\n\n const [animations, setAnimations] = useState<string | undefined>(() => {\n for (const [key, styles] of Object.entries(arrayOrObj))\n if (isArray(styles))\n cache.current.set(\n key,\n styles.map((style) => animation(style, { css, system })).join(\", \"),\n )\n else cache.current.set(key, animation(styles, { css, system }))\n\n if (isArray(keys.current))\n return keys.current.map((key) => cache.current.get(key)).join(\", \")\n else return cache.current.get(keys.current ?? \"\")\n })\n\n const setAnimation = useCallback(\n (\n keysOrFunc:\n | ((key: (keyof Y)[] | keyof Y | undefined) => (keyof Y)[] | keyof Y)\n | (keyof Y)[]\n | keyof Y,\n ) => {\n const args = (() => {\n if (!isUndefined(keys.current) && isArray(arrayOrObj))\n return isArray(keys.current)\n ? keys.current.map(Number)\n : Number(keys.current)\n else return keys.current\n })() as (keyof Y)[] | keyof Y | undefined\n\n const keyOrArray = runIfFn(keysOrFunc, args)\n\n keys.current = isArray(keyOrArray)\n ? keyOrArray.map(String)\n : String(keyOrArray)\n\n if (isArray(keys.current))\n setAnimations(\n keys.current.map((key) => cache.current.get(key)).join(\", \"),\n )\n else setAnimations(cache.current.get(keys.current))\n },\n [arrayOrObj],\n )\n\n return [animations, setAnimation]\n}\n"],"mappings":";;;;;;;;;;;;AAgBA,MAAa,gBAAgB,WAA8B;CACzD,MAAM,SAAS,UAAU;CAEzB,KAAA,GAAIA,cAAAA,QAAAA,CAAQ,MAAM,GAChB,OAAO,OAAO,KAAK,WAAW,UAAU,QAAQ;EAAE;EAAK;CAAO,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI;MACxE,OAAO,UAAU,QAAQ;EAAE;EAAK;CAAO,CAAC;AAC/C;;;;;;AAOA,MAAa,uBAKX,YACA,SASG;CACH,MAAM,SAAS,UAAU;CAEzB,MAAM,OAAO,OACX,EAAA,GAACC,cAAAA,YAAAA,CAAY,IAAI,KAAA,GACbD,cAAAA,QAAAA,CAAQ,IAAI,IACV,KAAK,IAAI,MAAM,IACf,OAAO,IAAI,IACb,KAAA,CACN;CACA,MAAM,QAAQ,uBAA4B,IAAI,IAAoB,CAAC;CAEnE,MAAM,CAAC,YAAY,iBAAiB,eAAmC;EACrE,KAAK,MAAM,CAAC,KAAK,WAAW,OAAO,QAAQ,UAAU,GACnD,KAAA,GAAIA,cAAAA,QAAAA,CAAQ,MAAM,GAChB,MAAM,QAAQ,IACZ,KACA,OAAO,KAAK,UAAU,UAAU,OAAO;GAAE;GAAK;EAAO,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CACpE;OACG,MAAM,QAAQ,IAAI,KAAK,UAAU,QAAQ;GAAE;GAAK;EAAO,CAAC,CAAC;EAEhE,KAAA,GAAIA,cAAAA,QAAAA,CAAQ,KAAK,OAAO,GACtB,OAAO,KAAK,QAAQ,KAAK,QAAQ,MAAM,QAAQ,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,IAAI;OAC/D,OAAO,MAAM,QAAQ,IAAI,KAAK,WAAW,EAAE;CAClD,CAAC;CAgCD,OAAO,CAAC,YA9Ba,aAEjB,eAIG;EACH,MAAM,cAAc;GAClB,IAAI,EAAA,GAACC,cAAAA,YAAAA,CAAY,KAAK,OAAO,MAAA,GAAKD,cAAAA,QAAAA,CAAQ,UAAU,GAClD,QAAA,GAAOA,cAAAA,QAAAA,CAAQ,KAAK,OAAO,IACvB,KAAK,QAAQ,IAAI,MAAM,IACvB,OAAO,KAAK,OAAO;QACpB,OAAO,KAAK;EACnB,EAAA,CAAG;EAEH,MAAM,cAAA,GAAaE,cAAAA,QAAAA,CAAQ,YAAY,IAAI;EAE3C,KAAK,WAAA,GAAUF,cAAAA,QAAAA,CAAQ,UAAU,IAC7B,WAAW,IAAI,MAAM,IACrB,OAAO,UAAU;EAErB,KAAA,GAAIA,cAAAA,QAAAA,CAAQ,KAAK,OAAO,GACtB,cACE,KAAK,QAAQ,KAAK,QAAQ,MAAM,QAAQ,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,IAAI,CAC7D;OACG,cAAc,MAAM,QAAQ,IAAI,KAAK,OAAO,CAAC;CACpD,GACA,CAAC,UAAU,CAGkB,CAAC;AAClC"}
1
+ {"version":3,"file":"index.js","names":["isArray","isUndefined","runIfFn"],"sources":["../../../../src/hooks/use-animation/index.ts"],"sourcesContent":["\"use client\"\n\nimport type { CSSAnimationObject, Token } from \"../../core\"\nimport { useCallback, useRef, useState } from \"react\"\nimport { animation, css, useSystem } from \"../../core\"\nimport { isArray, isUndefined, runIfFn } from \"../../utils\"\n\nexport type UseAnimationProps =\n | Token<CSSAnimationObject, \"animations\">\n | Token<CSSAnimationObject, \"animations\">[]\n\n/**\n * `useAnimation` is a custom hook that implements animations similar to CSS `keyframes`.\n *\n * @see https://yamada-ui.com/docs/hooks/use-animation\n */\nexport const useAnimation = (arrayOrObj: UseAnimationProps): string => {\n const system = useSystem()\n\n if (isArray(arrayOrObj))\n return arrayOrObj.map((obj) => animation(obj, { css, system })).join(\", \")\n else return animation(arrayOrObj, { css, system })\n}\n\nexport type UseDynamicAnimationProps =\n | Token<CSSAnimationObject, \"animations\">[]\n | { [key: string]: UseAnimationProps }\n\n/**\n * `useDynamicAnimation` is a custom hook used to switch animations.\n *\n * @see https://yamada-ui.com/docs/hooks/use-dynamic-animation\n */\nexport const useDynamicAnimation = <Y extends UseDynamicAnimationProps>(\n arrayOrObj: Y,\n init?: (keyof Y)[] | keyof Y,\n): [\n string | undefined,\n (\n key:\n | ((key: (keyof Y)[] | keyof Y | undefined) => (keyof Y)[] | keyof Y)\n | (keyof Y)[]\n | keyof Y,\n ) => void,\n] => {\n const system = useSystem()\n\n const keys = useRef<string | string[] | undefined>(\n !isUndefined(init)\n ? isArray(init)\n ? init.map(String)\n : String(init)\n : undefined,\n )\n const cache = useRef<Map<string, string>>(new Map<string, string>())\n\n const [animations, setAnimations] = useState<string | undefined>(() => {\n for (const [key, styles] of Object.entries(arrayOrObj))\n if (isArray(styles))\n cache.current.set(\n key,\n styles.map((style) => animation(style, { css, system })).join(\", \"),\n )\n else cache.current.set(key, animation(styles, { css, system }))\n\n if (isArray(keys.current))\n return keys.current.map((key) => cache.current.get(key)).join(\", \")\n else return cache.current.get(keys.current ?? \"\")\n })\n\n const setAnimation = useCallback(\n (\n keysOrFunc:\n | ((key: (keyof Y)[] | keyof Y | undefined) => (keyof Y)[] | keyof Y)\n | (keyof Y)[]\n | keyof Y,\n ) => {\n const args = (() => {\n if (!isUndefined(keys.current) && isArray(arrayOrObj))\n return isArray(keys.current)\n ? keys.current.map(Number)\n : Number(keys.current)\n else return keys.current\n })() as (keyof Y)[] | keyof Y | undefined\n\n const keyOrArray = runIfFn(keysOrFunc, args)\n\n keys.current = isArray(keyOrArray)\n ? keyOrArray.map(String)\n : String(keyOrArray)\n\n if (isArray(keys.current))\n setAnimations(\n keys.current.map((key) => cache.current.get(key)).join(\", \"),\n )\n else setAnimations(cache.current.get(keys.current))\n },\n [arrayOrObj],\n )\n\n return [animations, setAnimation]\n}\n"],"mappings":";;;;;;;;;;;;AAgBA,MAAa,gBAAgB,eAA0C;CACrE,MAAM,SAAS,UAAU;CAEzB,KAAA,GAAIA,cAAAA,QAAAA,CAAQ,UAAU,GACpB,OAAO,WAAW,KAAK,QAAQ,UAAU,KAAK;EAAE;EAAK;CAAO,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI;MACtE,OAAO,UAAU,YAAY;EAAE;EAAK;CAAO,CAAC;AACnD;;;;;;AAWA,MAAa,uBACX,YACA,SASG;CACH,MAAM,SAAS,UAAU;CAEzB,MAAM,OAAO,OACX,EAAA,GAACC,cAAAA,YAAAA,CAAY,IAAI,KAAA,GACbD,cAAAA,QAAAA,CAAQ,IAAI,IACV,KAAK,IAAI,MAAM,IACf,OAAO,IAAI,IACb,KAAA,CACN;CACA,MAAM,QAAQ,uBAA4B,IAAI,IAAoB,CAAC;CAEnE,MAAM,CAAC,YAAY,iBAAiB,eAAmC;EACrE,KAAK,MAAM,CAAC,KAAK,WAAW,OAAO,QAAQ,UAAU,GACnD,KAAA,GAAIA,cAAAA,QAAAA,CAAQ,MAAM,GAChB,MAAM,QAAQ,IACZ,KACA,OAAO,KAAK,UAAU,UAAU,OAAO;GAAE;GAAK;EAAO,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CACpE;OACG,MAAM,QAAQ,IAAI,KAAK,UAAU,QAAQ;GAAE;GAAK;EAAO,CAAC,CAAC;EAEhE,KAAA,GAAIA,cAAAA,QAAAA,CAAQ,KAAK,OAAO,GACtB,OAAO,KAAK,QAAQ,KAAK,QAAQ,MAAM,QAAQ,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,IAAI;OAC/D,OAAO,MAAM,QAAQ,IAAI,KAAK,WAAW,EAAE;CAClD,CAAC;CAgCD,OAAO,CAAC,YA9Ba,aAEjB,eAIG;EACH,MAAM,cAAc;GAClB,IAAI,EAAA,GAACC,cAAAA,YAAAA,CAAY,KAAK,OAAO,MAAA,GAAKD,cAAAA,QAAAA,CAAQ,UAAU,GAClD,QAAA,GAAOA,cAAAA,QAAAA,CAAQ,KAAK,OAAO,IACvB,KAAK,QAAQ,IAAI,MAAM,IACvB,OAAO,KAAK,OAAO;QACpB,OAAO,KAAK;EACnB,EAAA,CAAG;EAEH,MAAM,cAAA,GAAaE,cAAAA,QAAAA,CAAQ,YAAY,IAAI;EAE3C,KAAK,WAAA,GAAUF,cAAAA,QAAAA,CAAQ,UAAU,IAC7B,WAAW,IAAI,MAAM,IACrB,OAAO,UAAU;EAErB,KAAA,GAAIA,cAAAA,QAAAA,CAAQ,KAAK,OAAO,GACtB,cACE,KAAK,QAAQ,KAAK,QAAQ,MAAM,QAAQ,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,IAAI,CAC7D;OACG,cAAc,MAAM,QAAQ,IAAI,KAAK,OAAO,CAAC;CACpD,GACA,CAAC,UAAU,CAGkB,CAAC;AAClC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["isValidElement","isTouchDevice","dataAttr"],"sources":["../../../../src/hooks/use-clickable/index.ts"],"sourcesContent":["\"use client\"\n\nimport type { HTMLAttributes, KeyboardEvent, MouseEvent, Ref } from \"react\"\nimport type { StyledProps } from \"../../core\"\nimport { useCallback, useState } from \"react\"\nimport { dataAttr, isTouchDevice, mergeRefs } from \"../../utils\"\nimport { useEventListeners } from \"../use-event-listener\"\n\ntype Props<Y extends HTMLElement = HTMLElement> = Omit<\n HTMLAttributes<Y>,\n \"ref\" | \"size\" | keyof StyledProps\n>\n\nexport type UseClickableProps<\n Y extends HTMLElement = HTMLElement,\n M extends Props<Y> = Props<Y>,\n> = M & {\n /**\n * Whether or not trigger click on pressing `Enter`.\n *\n * @default true\n */\n clickOnEnter?: boolean\n /**\n * Whether or not trigger click on pressing `Space`.\n *\n * @default true\n */\n clickOnSpace?: boolean\n /**\n * If `true`, the element will be disabled. It will set the `disabled` HTML attribute.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * Disable the touch device behavior.\n *\n * @default true\n */\n disableTouchBehavior?: boolean\n /**\n * If `true` and isDisabled, the element will have only `aria-disabled` set to `true`.\n *\n * @default false\n */\n focusable?: boolean\n /**\n * Whether or not to focus the element when it is clicked.\n * If `true`, the element will receive focus upon click.\n *\n * @default true\n */\n focusOnClick?: boolean\n /**\n * The ref for the element.\n */\n ref?: Ref<Y>\n}\n\nconst isValidElement = (\n ev: KeyboardEvent | KeyboardEvent[\"nativeEvent\"],\n): boolean => {\n const { isContentEditable, tagName } = ev.target as HTMLElement\n\n return tagName !== \"INPUT\" && tagName !== \"TEXTAREA\" && !isContentEditable\n}\n\nexport const useClickable = <\n Y extends HTMLElement = HTMLElement,\n M extends Props<Y> = Props<Y>,\n>(\n {\n ref,\n clickOnEnter = true,\n clickOnSpace = true,\n disabled,\n disableTouchBehavior = true,\n focusable,\n focusOnClick = true,\n tabIndex: tabIndexProp,\n onClick: onClickProp,\n onKeyDown: onKeyDownProp,\n onKeyUp: onKeyUpProp,\n onMouseDown: onMouseDownProp,\n onMouseLeave: onMouseLeaveProp,\n onMouseOver: onMouseOverProp,\n onMouseUp: onMouseUpProp,\n ...props\n }: UseClickableProps<Y, M> = {} as UseClickableProps<Y, M>,\n) => {\n const [button, setButton] = useState<boolean>(true)\n const [pressed, setPressed] = useState<boolean>(false)\n\n const listeners = useEventListeners()\n\n const tabIndex = button ? tabIndexProp : tabIndexProp || 0\n const trulyDisabled = disabled && !focusable\n\n const refCb = (node: any) => {\n if (!node) return\n\n if (node.tagName !== \"BUTTON\") setButton(false)\n }\n\n const onClick = useCallback(\n (ev: MouseEvent<Y>) => {\n if (disabled) {\n ev.stopPropagation()\n ev.preventDefault()\n\n return\n }\n\n if (focusOnClick) ev.currentTarget.focus()\n onClickProp?.(ev)\n },\n [disabled, focusOnClick, onClickProp],\n )\n\n const onDocumentKeyUp = useCallback(\n (ev: globalThis.KeyboardEvent) => {\n if (pressed && isValidElement(ev)) {\n ev.preventDefault()\n ev.stopPropagation()\n\n setPressed(false)\n\n listeners.remove(document, \"keyup\", onDocumentKeyUp, false)\n }\n },\n [pressed, listeners],\n )\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent<Y>) => {\n onKeyDownProp?.(ev)\n\n if (disabled || ev.defaultPrevented || ev.metaKey) return\n\n if (!isValidElement(ev.nativeEvent) || button) return\n\n if (clickOnSpace && ev.key === \" \") {\n ev.preventDefault()\n setPressed(true)\n }\n\n if (clickOnEnter && ev.key === \"Enter\") {\n ev.preventDefault()\n ev.currentTarget.click()\n }\n\n listeners.add(document, \"keyup\", onDocumentKeyUp, false)\n },\n [\n disabled,\n button,\n onKeyDownProp,\n clickOnEnter,\n clickOnSpace,\n listeners,\n onDocumentKeyUp,\n ],\n )\n\n const onKeyUp = useCallback(\n (ev: KeyboardEvent<Y>) => {\n onKeyUpProp?.(ev)\n\n if (disabled || ev.defaultPrevented || ev.metaKey) return\n\n if (!isValidElement(ev.nativeEvent) || button) return\n\n if (clickOnSpace && ev.key === \" \") {\n ev.preventDefault()\n setPressed(false)\n\n ev.currentTarget.click()\n }\n },\n [clickOnSpace, button, disabled, onKeyUpProp],\n )\n\n const onDocumentMouseUp = useCallback(\n (ev: globalThis.MouseEvent) => {\n if (ev.button !== 0) return\n\n setPressed(false)\n\n listeners.remove(document, \"mouseup\", onDocumentMouseUp, false)\n },\n [listeners],\n )\n\n const onMouseDown = useCallback(\n (ev: MouseEvent<Y>) => {\n if (ev.button !== 0) return\n\n if (disabled) {\n ev.stopPropagation()\n ev.preventDefault()\n\n return\n }\n\n if (!button) setPressed(true)\n\n if (focusOnClick) ev.currentTarget.focus({ preventScroll: true })\n\n listeners.add(document, \"mouseup\", onDocumentMouseUp, false)\n\n onMouseDownProp?.(ev)\n },\n [\n disabled,\n button,\n onMouseDownProp,\n listeners,\n onDocumentMouseUp,\n focusOnClick,\n ],\n )\n\n const onMouseUp = useCallback(\n (ev: MouseEvent<Y>) => {\n if (ev.button !== 0) return\n\n if (!button) setPressed(false)\n\n onMouseUpProp?.(ev)\n },\n [onMouseUpProp, button],\n )\n\n const onMouseOver = useCallback(\n (ev: MouseEvent<Y>) => {\n if (disabled) {\n ev.preventDefault()\n\n return\n }\n\n if (disableTouchBehavior && isTouchDevice()) return\n\n onMouseOverProp?.(ev)\n },\n [disabled, onMouseOverProp, disableTouchBehavior],\n )\n\n const onMouseLeave = useCallback(\n (ev: MouseEvent<Y>) => {\n if (pressed) {\n ev.preventDefault()\n\n setPressed(false)\n }\n\n if (disableTouchBehavior && isTouchDevice()) return\n\n onMouseLeaveProp?.(ev)\n },\n [pressed, onMouseLeaveProp, disableTouchBehavior],\n )\n\n if (button)\n return {\n ...props,\n ref: mergeRefs(ref, refCb),\n type: \"button\" as const,\n \"aria-disabled\": trulyDisabled ? undefined : disabled,\n disabled: trulyDisabled,\n onClick: onClick,\n onKeyDown: onKeyDownProp,\n onKeyUp: onKeyUpProp,\n onMouseDown: onMouseDownProp,\n onMouseLeave: onMouseLeaveProp,\n onMouseOver: onMouseOverProp,\n onMouseUp: onMouseUpProp,\n }\n else\n return {\n ...props,\n ref: mergeRefs(ref, refCb),\n \"aria-disabled\": disabled ? (\"true\" as const) : undefined,\n \"data-active\": dataAttr(pressed),\n role: \"button\",\n tabIndex: trulyDisabled ? undefined : tabIndex,\n onClick,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onMouseLeave,\n onMouseOver,\n onMouseUp,\n }\n}\n\nexport type UseClickableReturn = ReturnType<typeof useClickable>\n"],"mappings":";;;;;;AA4DA,MAAMA,oBACJ,OACY;CACZ,MAAM,EAAE,mBAAmB,YAAY,GAAG;CAE1C,OAAO,YAAY,WAAW,YAAY,cAAc,CAAC;AAC3D;AAEA,MAAa,gBAIX,EACE,KACA,eAAe,MACf,eAAe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SAAS;GACX,GAAG,eAAe;GAElB,WAAW,KAAK;EAClB;EAEA,IAAI,yBAAA,GAAwBA,cAAAA,cAAAA,CAAc,GAAG;EAE7C,mBAAmB,EAAE;CACvB,GACA;EAAC;EAAS;EAAkB;CAAoB,CAClD;CAEA,IAAI,QACF,OAAO;EACL,GAAG;EACH,KAAK,UAAU,KAAK,KAAK;EACzB,MAAM;EACN,iBAAiB,gBAAgB,KAAA,IAAY;EAC7C,UAAU;EACD;EACT,WAAW;EACX,SAAS;EACT,aAAa;EACb,cAAc;EACd,aAAa;EACb,WAAW;CACb;MAEA,OAAO;EACL,GAAG;EACH,KAAK,UAAU,KAAK,KAAK;EACzB,iBAAiB,WAAY,SAAmB,KAAA;EAChD,gBAAA,GAAeC,cAAAA,SAAAA,CAAS,OAAO;EAC/B,MAAM;EACN,UAAU,gBAAgB,KAAA,IAAY;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACJ"}
1
+ {"version":3,"file":"index.js","names":["isValidElement","isTouchDevice","dataAttr"],"sources":["../../../../src/hooks/use-clickable/index.ts"],"sourcesContent":["\"use client\"\n\nimport type { HTMLAttributes, KeyboardEvent, MouseEvent, Ref } from \"react\"\nimport type { StyledProps } from \"../../core\"\nimport { useCallback, useState } from \"react\"\nimport { dataAttr, isTouchDevice, mergeRefs } from \"../../utils\"\nimport { useEventListeners } from \"../use-event-listener\"\n\nexport type UseClickableElementProps<Y extends HTMLElement = HTMLElement> =\n Omit<HTMLAttributes<Y>, \"ref\" | \"size\" | keyof StyledProps>\n\nexport type UseClickableProps<\n Y extends HTMLElement = HTMLElement,\n M extends UseClickableElementProps<Y> = UseClickableElementProps<Y>,\n> = M & {\n /**\n * Whether or not trigger click on pressing `Enter`.\n *\n * @default true\n */\n clickOnEnter?: boolean\n /**\n * Whether or not trigger click on pressing `Space`.\n *\n * @default true\n */\n clickOnSpace?: boolean\n /**\n * If `true`, the element will be disabled. It will set the `disabled` HTML attribute.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * Disable the touch device behavior.\n *\n * @default true\n */\n disableTouchBehavior?: boolean\n /**\n * If `true` and isDisabled, the element will have only `aria-disabled` set to `true`.\n *\n * @default false\n */\n focusable?: boolean\n /**\n * Whether or not to focus the element when it is clicked.\n * If `true`, the element will receive focus upon click.\n *\n * @default true\n */\n focusOnClick?: boolean\n /**\n * The ref for the element.\n */\n ref?: Ref<Y>\n}\n\nconst isValidElement = (\n ev: KeyboardEvent | KeyboardEvent[\"nativeEvent\"],\n): boolean => {\n const { isContentEditable, tagName } = ev.target as HTMLElement\n\n return tagName !== \"INPUT\" && tagName !== \"TEXTAREA\" && !isContentEditable\n}\n\nexport const useClickable = <\n Y extends HTMLElement = HTMLElement,\n M extends UseClickableElementProps<Y> = UseClickableElementProps<Y>,\n>(\n {\n ref,\n clickOnEnter = true,\n clickOnSpace = true,\n disabled,\n disableTouchBehavior = true,\n focusable,\n focusOnClick = true,\n tabIndex: tabIndexProp,\n onClick: onClickProp,\n onKeyDown: onKeyDownProp,\n onKeyUp: onKeyUpProp,\n onMouseDown: onMouseDownProp,\n onMouseLeave: onMouseLeaveProp,\n onMouseOver: onMouseOverProp,\n onMouseUp: onMouseUpProp,\n ...props\n }: UseClickableProps<Y, M> = {} as UseClickableProps<Y, M>,\n) => {\n const [button, setButton] = useState<boolean>(true)\n const [pressed, setPressed] = useState<boolean>(false)\n\n const listeners = useEventListeners()\n\n const tabIndex = button ? tabIndexProp : tabIndexProp || 0\n const trulyDisabled = disabled && !focusable\n\n const refCb = (node: any) => {\n if (!node) return\n\n if (node.tagName !== \"BUTTON\") setButton(false)\n }\n\n const onClick = useCallback(\n (ev: MouseEvent<Y>) => {\n if (disabled) {\n ev.stopPropagation()\n ev.preventDefault()\n\n return\n }\n\n if (focusOnClick) ev.currentTarget.focus()\n onClickProp?.(ev)\n },\n [disabled, focusOnClick, onClickProp],\n )\n\n const onDocumentKeyUp = useCallback(\n (ev: globalThis.KeyboardEvent) => {\n if (pressed && isValidElement(ev)) {\n ev.preventDefault()\n ev.stopPropagation()\n\n setPressed(false)\n\n listeners.remove(document, \"keyup\", onDocumentKeyUp, false)\n }\n },\n [pressed, listeners],\n )\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent<Y>) => {\n onKeyDownProp?.(ev)\n\n if (disabled || ev.defaultPrevented || ev.metaKey) return\n\n if (!isValidElement(ev.nativeEvent) || button) return\n\n if (clickOnSpace && ev.key === \" \") {\n ev.preventDefault()\n setPressed(true)\n }\n\n if (clickOnEnter && ev.key === \"Enter\") {\n ev.preventDefault()\n ev.currentTarget.click()\n }\n\n listeners.add(document, \"keyup\", onDocumentKeyUp, false)\n },\n [\n disabled,\n button,\n onKeyDownProp,\n clickOnEnter,\n clickOnSpace,\n listeners,\n onDocumentKeyUp,\n ],\n )\n\n const onKeyUp = useCallback(\n (ev: KeyboardEvent<Y>) => {\n onKeyUpProp?.(ev)\n\n if (disabled || ev.defaultPrevented || ev.metaKey) return\n\n if (!isValidElement(ev.nativeEvent) || button) return\n\n if (clickOnSpace && ev.key === \" \") {\n ev.preventDefault()\n setPressed(false)\n\n ev.currentTarget.click()\n }\n },\n [clickOnSpace, button, disabled, onKeyUpProp],\n )\n\n const onDocumentMouseUp = useCallback(\n (ev: globalThis.MouseEvent) => {\n if (ev.button !== 0) return\n\n setPressed(false)\n\n listeners.remove(document, \"mouseup\", onDocumentMouseUp, false)\n },\n [listeners],\n )\n\n const onMouseDown = useCallback(\n (ev: MouseEvent<Y>) => {\n if (ev.button !== 0) return\n\n if (disabled) {\n ev.stopPropagation()\n ev.preventDefault()\n\n return\n }\n\n if (!button) setPressed(true)\n\n if (focusOnClick) ev.currentTarget.focus({ preventScroll: true })\n\n listeners.add(document, \"mouseup\", onDocumentMouseUp, false)\n\n onMouseDownProp?.(ev)\n },\n [\n disabled,\n button,\n onMouseDownProp,\n listeners,\n onDocumentMouseUp,\n focusOnClick,\n ],\n )\n\n const onMouseUp = useCallback(\n (ev: MouseEvent<Y>) => {\n if (ev.button !== 0) return\n\n if (!button) setPressed(false)\n\n onMouseUpProp?.(ev)\n },\n [onMouseUpProp, button],\n )\n\n const onMouseOver = useCallback(\n (ev: MouseEvent<Y>) => {\n if (disabled) {\n ev.preventDefault()\n\n return\n }\n\n if (disableTouchBehavior && isTouchDevice()) return\n\n onMouseOverProp?.(ev)\n },\n [disabled, onMouseOverProp, disableTouchBehavior],\n )\n\n const onMouseLeave = useCallback(\n (ev: MouseEvent<Y>) => {\n if (pressed) {\n ev.preventDefault()\n\n setPressed(false)\n }\n\n if (disableTouchBehavior && isTouchDevice()) return\n\n onMouseLeaveProp?.(ev)\n },\n [pressed, onMouseLeaveProp, disableTouchBehavior],\n )\n\n if (button)\n return {\n ...props,\n ref: mergeRefs(ref, refCb),\n type: \"button\" as const,\n \"aria-disabled\": trulyDisabled ? undefined : disabled,\n disabled: trulyDisabled,\n onClick: onClick,\n onKeyDown: onKeyDownProp,\n onKeyUp: onKeyUpProp,\n onMouseDown: onMouseDownProp,\n onMouseLeave: onMouseLeaveProp,\n onMouseOver: onMouseOverProp,\n onMouseUp: onMouseUpProp,\n }\n else\n return {\n ...props,\n ref: mergeRefs(ref, refCb),\n \"aria-disabled\": disabled ? (\"true\" as const) : undefined,\n \"data-active\": dataAttr(pressed),\n role: \"button\",\n tabIndex: trulyDisabled ? undefined : tabIndex,\n onClick,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onMouseLeave,\n onMouseOver,\n onMouseUp,\n }\n}\n\nexport type UseClickableReturn = ReturnType<typeof useClickable>\n"],"mappings":";;;;;;AA0DA,MAAMA,oBACJ,OACY;CACZ,MAAM,EAAE,mBAAmB,YAAY,GAAG;CAE1C,OAAO,YAAY,WAAW,YAAY,cAAc,CAAC;AAC3D;AAEA,MAAa,gBAIX,EACE,KACA,eAAe,MACf,eAAe,MACf,UACA,uBAAuB,MACvB,WACA,eAAe,MACf,UAAU,cACV,SAAS,aACT,WAAW,eACX,SAAS,aACT,aAAa,iBACb,cAAc,kBACd,aAAa,i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,EAAE;CACvB,GACA;EAAC;EAAS;EAAkB;CAAoB,CAClD;CAEA,IAAI,QACF,OAAO;EACL,GAAG;EACH,KAAK,UAAU,KAAK,KAAK;EACzB,MAAM;EACN,iBAAiB,gBAAgB,KAAA,IAAY;EAC7C,UAAU;EACD;EACT,WAAW;EACX,SAAS;EACT,aAAa;EACb,cAAc;EACd,aAAa;EACb,WAAW;CACb;MAEA,OAAO;EACL,GAAG;EACH,KAAK,UAAU,KAAK,KAAK;EACzB,iBAAiB,WAAY,SAAmB,KAAA;EAChD,gBAAA,GAAeC,cAAAA,SAAAA,CAAS,OAAO;EAC/B,MAAM;EACN,UAAU,gBAAgB,KAAA,IAAY;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["handlerAll","isMultiTouchEvent","getEventPoint","addDomEvent"],"sources":["../../../../src/hooks/use-pan-event/index.ts"],"sourcesContent":["\"use client\"\n\nimport type {\n DataAttributes,\n HTMLAttributes,\n RefAttributes,\n RefObject,\n} from \"react\"\nimport type { Point } from \"../../utils\"\nimport { useCallback, useRef } from \"react\"\nimport { useEnvironment } from \"../../core\"\nimport {\n addDomEvent,\n getEventPoint,\n handlerAll,\n isMultiTouchEvent,\n mergeRefs,\n useCallbackRef,\n useUnmountEffect,\n} from \"../../utils\"\n\nexport interface PanEventProps {\n threshold?: number\n onEnd?: (ev: PointerEvent, point: Point, rect: DOMRect) => void\n onMove?: (ev: PointerEvent, point: Point, rect: DOMRect) => void\n onStart?: (ev: PointerEvent, point: Point, rect: DOMRect) => void\n}\n\ninterface Props<Y extends HTMLElement>\n extends DataAttributes, HTMLAttributes<Y>, RefAttributes<Y> {}\n\nexport const usePanEvent = <Y extends HTMLElement>({\n threshold = 3,\n ...rest\n}: PanEventProps = {}): [\n RefObject<null | Y>,\n (props?: Props<Y>) => Props<Y>,\n] => {\n const { getWindow } = useEnvironment()\n const onStart = useCallbackRef(rest.onStart)\n const onMove = useCallbackRef(rest.onMove)\n const onEnd = useCallbackRef(rest.onEnd)\n const latestPoint = useRef<null | Point>(null)\n const unsubscribe = useRef<(() => void)[]>([])\n const ref = useRef<Y>(null)\n\n const cleanup = useCallback(() => {\n unsubscribe.current.forEach((unsubscribe) => unsubscribe())\n\n latestPoint.current = null\n unsubscribe.current = []\n }, [])\n\n const shouldMove = useCallback(\n (point: Point) => {\n if (threshold === 0) return true\n if (!latestPoint.current) return true\n\n const distance = Math.sqrt(\n Math.pow(point.x - latestPoint.current.x, 2) +\n Math.pow(point.y - latestPoint.current.y, 2),\n )\n\n return distance >= threshold\n },\n [threshold],\n )\n\n useUnmountEffect(() => {\n cleanup()\n })\n\n const getProps = useCallback(\n (props: Props<Y> = {}) => {\n return {\n ...props,\n ref: mergeRefs(ref, props.ref),\n onPointerDown: handlerAll(props.onPointerDown, (ev) => {\n const win = ev.nativeEvent.view ?? getWindow()\n\n if (!win) return\n if (isMultiTouchEvent(ev.nativeEvent)) return\n if (!ref.current) return\n\n ev.preventDefault()\n\n const point = getEventPoint(ev.nativeEvent)\n const rect = ref.current.getBoundingClientRect()\n\n onStart(ev.nativeEvent, point, rect)\n\n latestPoint.current = point\n\n unsubscribe.current.push(\n addDomEvent(win, \"pointermove\", (ev) => {\n if (!ref.current) return\n\n const point = getEventPoint(ev)\n const rect = ref.current.getBoundingClientRect()\n\n if (!shouldMove(point)) return\n\n latestPoint.current = point\n\n onMove(ev, point, rect)\n }),\n )\n\n unsubscribe.current.push(\n addDomEvent(win, \"pointerup\", (ev) => {\n if (!ref.current) return\n\n cleanup()\n\n const point = getEventPoint(ev)\n const rect = ref.current.getBoundingClientRect()\n\n onEnd(ev, point, rect)\n }),\n )\n\n unsubscribe.current.push(\n addDomEvent(win, \"pointercancel\", (ev) => {\n if (!ref.current) return\n\n cleanup()\n\n const point = getEventPoint(ev)\n const rect = ref.current.getBoundingClientRect()\n\n onEnd(ev, point, rect)\n }),\n )\n }),\n }\n },\n [cleanup, getWindow, onEn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cAAAA,CAAc,GAAG,WAAW;IAC1C,MAAM,OAAO,IAAI,QAAQ,sBAAsB;IAE/C,QAAQ,GAAG,aAAa,OAAO,IAAI;IAEnC,YAAY,UAAU;IAEtB,YAAY,QAAQ,MAAA,GAClBC,cAAAA,YAAAA,CAAY,KAAK,gBAAgB,OAAO;KACtC,IAAI,CAAC,IAAI,SAAS;KAElB,MAAM,SAAA,GAAQD,cAAAA,cAAAA,CAAc,EAAE;KAC9B,MAAM,OAAO,IAAI,QAAQ,sBAAsB;KAE/C,IAAI,CAAC,WAAW,KAAK,GAAG;KAExB,YAAY,UAAU;KAEtB,OAAO,IAAI,OAAO,IAAI;IACxB,CAAC,CACH;IAEA,YAAY,QAAQ,MAAA,GAClBC,cAAAA,YAAAA,CAAY,KAAK,cAAc,OAAO;KACpC,IAAI,CAAC,IAAI,SAAS;KAElB,QAAQ;KAER,MAAM,SAAA,GAAQD,cAAAA,cAAAA,CAAc,EAAE;KAC9B,MAAM,OAAO,IAAI,QAAQ,sBAAsB;KAE/C,MAAM,IAAI,OAAO,IAAI;IACvB,CAAC,CACH;IAEA,YAAY,QAAQ,MAAA,GAClBC,cAAAA,YAAAA,CAAY,KAAK,kBAAkB,OAAO;KACxC,IAAI,CAAC,IAAI,SAAS;KAElB,QAAQ;KAER,MAAM,SAAA,GAAQD,cAAAA,cAAAA,CAAc,EAAE;KAC9B,MAAM,OAAO,IAAI,QAAQ,sBAAsB;KAE/C,MAAM,IAAI,OAAO,IAAI;IACvB,CAAC,CACH;GACF,CAAC;EACH;CACF,GACA;EAAC;EAAS;EAAW;EAAO;EAAQ;EAAS;CAAU,CAGrC,CAAC;AACvB"}
1
+ {"version":3,"file":"index.js","names":["handlerAll","isMultiTouchEvent","getEventPoint","addDomEvent"],"sources":["../../../../src/hooks/use-pan-event/index.ts"],"sourcesContent":["\"use client\"\n\nimport type {\n DataAttributes,\n HTMLAttributes,\n RefAttributes,\n RefObject,\n} from \"react\"\nimport type { Point } from \"../../utils\"\nimport { useCallback, useRef } from \"react\"\nimport { useEnvironment } from \"../../core\"\nimport {\n addDomEvent,\n getEventPoint,\n handlerAll,\n isMultiTouchEvent,\n mergeRefs,\n useCallbackRef,\n useUnmountEffect,\n} from \"../../utils\"\n\nexport interface UsePanEventProps {\n threshold?: number\n onEnd?: (ev: PointerEvent, point: Point, rect: DOMRect) => void\n onMove?: (ev: PointerEvent, point: Point, rect: DOMRect) => void\n onStart?: (ev: PointerEvent, point: Point, rect: DOMRect) => void\n}\n\nexport interface UsePanEventElementProps<Y extends HTMLElement>\n extends DataAttributes, HTMLAttributes<Y>, RefAttributes<Y> {}\n\nexport const usePanEvent = <Y extends HTMLElement>({\n threshold = 3,\n ...rest\n}: UsePanEventProps = {}): [\n RefObject<null | Y>,\n (props?: UsePanEventElementProps<Y>) => UsePanEventElementProps<Y>,\n] => {\n const { getWindow } = useEnvironment()\n const onStart = useCallbackRef(rest.onStart)\n const onMove = useCallbackRef(rest.onMove)\n const onEnd = useCallbackRef(rest.onEnd)\n const latestPoint = useRef<null | Point>(null)\n const unsubscribe = useRef<(() => void)[]>([])\n const ref = useRef<Y>(null)\n\n const cleanup = useCallback(() => {\n unsubscribe.current.forEach((unsubscribe) => unsubscribe())\n\n latestPoint.current = null\n unsubscribe.current = []\n }, [])\n\n const shouldMove = useCallback(\n (point: Point) => {\n if (threshold === 0) return true\n if (!latestPoint.current) return true\n\n const distance = Math.sqrt(\n Math.pow(point.x - latestPoint.current.x, 2) +\n Math.pow(point.y - latestPoint.current.y, 2),\n )\n\n return distance >= threshold\n },\n [threshold],\n )\n\n useUnmountEffect(() => {\n cleanup()\n })\n\n const getProps = useCallback(\n (props: UsePanEventElementProps<Y> = {}) => {\n return {\n ...props,\n ref: mergeRefs(ref, props.ref),\n onPointerDown: handlerAll(props.onPointerDown, (ev) => {\n const win = ev.nativeEvent.view ?? getWindow()\n\n if (!win) return\n if (isMultiTouchEvent(ev.nativeEvent)) return\n if (!ref.current) return\n\n ev.preventDefault()\n\n const point = getEventPoint(ev.nativeEvent)\n const rect = ref.current.getBoundingClientRect()\n\n onStart(ev.nativeEvent, point, rect)\n\n latestPoint.current = point\n\n unsubscribe.current.push(\n addDomEvent(win, \"pointermove\", (ev) => {\n if (!ref.current) return\n\n const point = getEventPoint(ev)\n const rect = ref.current.getBoundingClientRect()\n\n if (!shouldMove(point)) return\n\n latestPoint.current = point\n\n onMove(ev, point, rect)\n }),\n )\n\n unsubscribe.current.push(\n addDomEvent(win, \"pointerup\", (ev) => {\n if (!ref.current) return\n\n cleanup()\n\n const point = getEventPoint(ev)\n const rect = ref.current.getBoundingClientRect()\n\n onEnd(ev, point, rect)\n }),\n )\n\n unsubscribe.current.push(\n addDomEvent(win, \"pointercancel\", (ev) => {\n if (!ref.current) return\n\n cleanup()\n\n const point = getEventPoint(ev)\n const rect = ref.current.getBoundingClientRect()\n\n onEnd(ev, point, rect)\n }),\n )\n }),\n }\n },\n [cleanup, getWindow, onEnd, onMove, onStart, shouldMove],\n )\n\n return [ref, getProps] as const\n}\n\nexport type UsePanEventReturn = ReturnType<typeof usePanEvent>\n"],"mappings":";;;;;;;AA+BA,MAAa,eAAsC,EACjD,YAAY,GACZ,GAAG,SACiB,CAAC,MAGlB;CACH,MAAM,EAAE,cAAc,eAAe;CACrC,MAAM,UAAU,eAAe,KAAK,OAAO;CAC3C,MAAM,SAAS,eAAe,KAAK,MAAM;CACzC,MAAM,QAAQ,eAAe,KAAK,KAAK;CACvC,MAAM,cAAc,OAAqB,IAAI;CAC7C,MAAM,cAAc,OAAuB,CAAC,CAAC;CAC7C,MAAM,MAAM,OAAU,IAAI;CAE1B,MAAM,UAAU,kBAAkB;EAChC,YAAY,QAAQ,SAAS,gBAAgB,YAAY,CAAC;EAE1D,YAAY,UAAU;EACtB,YAAY,UAAU,CAAC;CACzB,GAAG,CAAC,CAAC;CAEL,MAAM,aAAa,aAChB,UAAiB;EAChB,IAAI,cAAc,GAAG,OAAO;EAC5B,IAAI,CAAC,YAAY,SAAS,OAAO;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IAAI,OAAO,IAAI;IACvB,CAAC,CACH;IAEA,YAAY,QAAQ,MAAA,GAClBC,cAAAA,YAAAA,CAAY,KAAK,kBAAkB,OAAO;KACxC,IAAI,CAAC,IAAI,SAAS;KAElB,QAAQ;KAER,MAAM,SAAA,GAAQD,cAAAA,cAAAA,CAAc,EAAE;KAC9B,MAAM,OAAO,IAAI,QAAQ,sBAAsB;KAE/C,MAAM,IAAI,OAAO,IAAI;IACvB,CAAC,CACH;GACF,CAAC;EACH;CACF,GACA;EAAC;EAAS;EAAW;EAAO;EAAQ;EAAS;CAAU,CAGrC,CAAC;AACvB"}
@@ -2,7 +2,7 @@ import { ComponentSlotStyle } from "../../core/system/index.type.js";
2
2
  import { CSSModifierObject, CSSPropObject, CSSSlotObject } from "../../core/css/index.type.js";
3
3
  import "../../index.js";
4
4
  //#region src/components/chart/cartesian-chart.style.d.ts
5
- export declare const cartesianChartStyle: ComponentSlotStyle<"area" | "line" | "grid" | "bar" | "dot" | "root" | "activeDot" | "labelList" | "referenceLine" | "referenceLineLabel" | "xAxis" | "xAxisLabel" | "xAxisTick" | "xAxisTickLine" | "yAxis" | "yAxisLabel" | "yAxisTick" | "yAxisTickLine", CSSPropObject<CSSSlotObject<"area" | "line" | "grid" | "bar" | "dot" | "root" | "activeDot" | "labelList" | "referenceLine" | "referenceLineLabel" | "xAxis" | "xAxisLabel" | "xAxisTick" | "xAxisTickLine" | "yAxis" | "yAxisLabel" | "yAxisTick" | "yAxisTickLine">>, CSSModifierObject<CSSSlotObject<"area" | "line" | "grid" | "bar" | "dot" | "root" | "activeDot" | "labelList" | "referenceLine" | "referenceLineLabel" | "xAxis" | "xAxisLabel" | "xAxisTick" | "xAxisTickLine" | "yAxis" | "yAxisLabel" | "yAxisTick" | "yAxisTickLine">>, CSSModifierObject<CSSSlotObject<"area" | "line" | "grid" | "bar" | "dot" | "root" | "activeDot" | "labelList" | "referenceLine" | "referenceLineLabel" | "xAxis" | "xAxisLabel" | "xAxisTick" | "xAxisTickLine" | "yAxis" | "yAxisLabel" | "yAxisTick" | "yAxisTickLine">>>;
5
+ export declare const cartesianChartStyle: ComponentSlotStyle<"area" | "line" | "grid" | "bar" | "dot" | "root" | "labelList" | "activeDot" | "referenceLine" | "referenceLineLabel" | "xAxis" | "xAxisLabel" | "xAxisTick" | "xAxisTickLine" | "yAxis" | "yAxisLabel" | "yAxisTick" | "yAxisTickLine", CSSPropObject<CSSSlotObject<"area" | "line" | "grid" | "bar" | "dot" | "root" | "labelList" | "activeDot" | "referenceLine" | "referenceLineLabel" | "xAxis" | "xAxisLabel" | "xAxisTick" | "xAxisTickLine" | "yAxis" | "yAxisLabel" | "yAxisTick" | "yAxisTickLine">>, CSSModifierObject<CSSSlotObject<"area" | "line" | "grid" | "bar" | "dot" | "root" | "labelList" | "activeDot" | "referenceLine" | "referenceLineLabel" | "xAxis" | "xAxisLabel" | "xAxisTick" | "xAxisTickLine" | "yAxis" | "yAxisLabel" | "yAxisTick" | "yAxisTickLine">>, CSSModifierObject<CSSSlotObject<"area" | "line" | "grid" | "bar" | "dot" | "root" | "labelList" | "activeDot" | "referenceLine" | "referenceLineLabel" | "xAxis" | "xAxisLabel" | "xAxisTick" | "xAxisTickLine" | "yAxis" | "yAxisLabel" | "yAxisTick" | "yAxisTickLine">>>;
6
6
  export type CartesianChartStyle = typeof cartesianChartStyle;
7
7
  //#endregion
8
8
  //# sourceMappingURL=cartesian-chart.style.d.ts.map
@@ -2,7 +2,7 @@ import { ComponentSlotStyle } from "../../core/system/index.type.js";
2
2
  import { CSSModifierObject, CSSPropObject, CSSSlotObject } from "../../core/css/index.type.js";
3
3
  import "../../index.js";
4
4
  //#region src/components/chart/polar-chart.style.d.ts
5
- export declare const polarChartStyle: ComponentSlotStyle<"label" | "grid" | "dot" | "root" | "activeDot" | "angleAxis" | "angleAxisLabel" | "angleAxisLine" | "angleAxisTick" | "angleAxisTickLine" | "labelLine" | "labelList" | "pie" | "radar" | "radial" | "radialBackground" | "radiusAxis" | "radiusAxisLabel" | "radiusAxisLine" | "radiusAxisTick" | "radiusAxisTickLine" | "sector", CSSPropObject<CSSSlotObject<"label" | "grid" | "dot" | "root" | "activeDot" | "angleAxis" | "angleAxisLabel" | "angleAxisLine" | "angleAxisTick" | "angleAxisTickLine" | "labelLine" | "labelList" | "pie" | "radar" | "radial" | "radialBackground" | "radiusAxis" | "radiusAxisLabel" | "radiusAxisLine" | "radiusAxisTick" | "radiusAxisTickLine" | "sector">>, CSSModifierObject<CSSSlotObject<"label" | "grid" | "dot" | "root" | "activeDot" | "angleAxis" | "angleAxisLabel" | "angleAxisLine" | "angleAxisTick" | "angleAxisTickLine" | "labelLine" | "labelList" | "pie" | "radar" | "radial" | "radialBackground" | "radiusAxis" | "radiusAxisLabel" | "radiusAxisLine" | "radiusAxisTick" | "radiusAxisTickLine" | "sector">>, CSSModifierObject<CSSSlotObject<"label" | "grid" | "dot" | "root" | "activeDot" | "angleAxis" | "angleAxisLabel" | "angleAxisLine" | "angleAxisTick" | "angleAxisTickLine" | "labelLine" | "labelList" | "pie" | "radar" | "radial" | "radialBackground" | "radiusAxis" | "radiusAxisLabel" | "radiusAxisLine" | "radiusAxisTick" | "radiusAxisTickLine" | "sector">>>;
5
+ export declare const polarChartStyle: ComponentSlotStyle<"label" | "grid" | "dot" | "root" | "labelList" | "radial" | "labelLine" | "activeDot" | "angleAxis" | "angleAxisLabel" | "angleAxisLine" | "angleAxisTick" | "angleAxisTickLine" | "pie" | "radar" | "radialBackground" | "radiusAxis" | "radiusAxisLabel" | "radiusAxisLine" | "radiusAxisTick" | "radiusAxisTickLine" | "sector", CSSPropObject<CSSSlotObject<"label" | "grid" | "dot" | "root" | "labelList" | "radial" | "labelLine" | "activeDot" | "angleAxis" | "angleAxisLabel" | "angleAxisLine" | "angleAxisTick" | "angleAxisTickLine" | "pie" | "radar" | "radialBackground" | "radiusAxis" | "radiusAxisLabel" | "radiusAxisLine" | "radiusAxisTick" | "radiusAxisTickLine" | "sector">>, CSSModifierObject<CSSSlotObject<"label" | "grid" | "dot" | "root" | "labelList" | "radial" | "labelLine" | "activeDot" | "angleAxis" | "angleAxisLabel" | "angleAxisLine" | "angleAxisTick" | "angleAxisTickLine" | "pie" | "radar" | "radialBackground" | "radiusAxis" | "radiusAxisLabel" | "radiusAxisLine" | "radiusAxisTick" | "radiusAxisTickLine" | "sector">>, CSSModifierObject<CSSSlotObject<"label" | "grid" | "dot" | "root" | "labelList" | "radial" | "labelLine" | "activeDot" | "angleAxis" | "angleAxisLabel" | "angleAxisLine" | "angleAxisTick" | "angleAxisTickLine" | "pie" | "radar" | "radialBackground" | "radiusAxis" | "radiusAxisLabel" | "radiusAxisLine" | "radiusAxisTick" | "radiusAxisTickLine" | "sector">>>;
6
6
  export type PolarChartStyle = typeof polarChartStyle;
7
7
  //#endregion
8
8
  //# sourceMappingURL=polar-chart.style.d.ts.map
@@ -1,4 +1,4 @@
1
1
  import { GroupStyle, groupStyle } from "./group.style.js";
2
2
  import { Group, GroupProps, GroupPropsContext, useGroupPropsContext } from "./group.js";
3
- import { UseGroupItemReturn, UseGroupReturn, useGroup, useGroupItemProps } from "./use-group.js";
4
- export { Group, type GroupProps, GroupPropsContext, GroupStyle, UseGroupItemReturn, UseGroupReturn, groupStyle, useGroup, useGroupItemProps, useGroupPropsContext };
3
+ import { UseGroupItemProps, UseGroupItemReturn, UseGroupReturn, useGroup, useGroupItemProps } from "./use-group.js";
4
+ export { Group, type GroupProps, GroupPropsContext, GroupStyle, UseGroupItemProps, UseGroupItemReturn, UseGroupReturn, groupStyle, useGroup, useGroupItemProps, useGroupPropsContext };
@@ -2,10 +2,10 @@ import { CSSProperties, DataAttributes, ReactNode } from "react";
2
2
  //#region src/components/group/use-group.d.ts
3
3
  export declare const useGroup: (children?: ReactNode) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>[];
4
4
  export type UseGroupReturn = ReturnType<typeof useGroup>;
5
- interface Props extends DataAttributes {
5
+ export interface UseGroupItemProps extends DataAttributes {
6
6
  style?: CSSProperties;
7
7
  }
8
- export declare const useGroupItemProps: <Y extends Props>({ style: { "--group-count": groupCount, "--group-index": groupIndex, ...style }, "data-group-between": dataGroupBetween, "data-group-end": dataGroupEnd, "data-group-start": dataGroupStart, "data-peer": dataPeer, ...rest }: Y) => readonly [{
8
+ export declare const useGroupItemProps: <Y extends UseGroupItemProps>({ style: { "--group-count": groupCount, "--group-index": groupIndex, ...style }, "data-group-between": dataGroupBetween, "data-group-end": dataGroupEnd, "data-group-start": dataGroupStart, "data-peer": dataPeer, ...rest }: Y) => readonly [{
9
9
  style: {
10
10
  "--group-count": string | number;
11
11
  "--group-index": string | number;
@@ -1,20 +1,21 @@
1
1
  import { CSSAnimationObject, Token } from "../../core/css/index.type.js";
2
2
  import "../../core/index.js";
3
3
  //#region src/hooks/use-animation/index.d.ts
4
- type CSSObject = Token<CSSAnimationObject, "animations"> | Token<CSSAnimationObject, "animations">[];
4
+ export type UseAnimationProps = Token<CSSAnimationObject, "animations"> | Token<CSSAnimationObject, "animations">[];
5
5
  /**
6
6
  * `useAnimation` is a custom hook that implements animations similar to CSS `keyframes`.
7
7
  *
8
8
  * @see https://yamada-ui.com/docs/hooks/use-animation
9
9
  */
10
- export declare const useAnimation: (cssObj: CSSObject) => string;
10
+ export declare const useAnimation: (arrayOrObj: UseAnimationProps) => string;
11
+ export type UseDynamicAnimationProps = Token<CSSAnimationObject, "animations">[] | {
12
+ [key: string]: UseAnimationProps;
13
+ };
11
14
  /**
12
15
  * `useDynamicAnimation` is a custom hook used to switch animations.
13
16
  *
14
17
  * @see https://yamada-ui.com/docs/hooks/use-dynamic-animation
15
18
  */
16
- export declare const useDynamicAnimation: <Y extends Token<CSSAnimationObject, "animations">[] | {
17
- [key: string]: CSSObject;
18
- }>(arrayOrObj: Y, init?: (keyof Y)[] | keyof Y) => [string | undefined, (key: ((key: (keyof Y)[] | keyof Y | undefined) => (keyof Y)[] | keyof Y) | (keyof Y)[] | keyof Y) => void];
19
+ export declare const useDynamicAnimation: <Y extends UseDynamicAnimationProps>(arrayOrObj: Y, init?: (keyof Y)[] | keyof Y) => [string | undefined, (key: ((key: (keyof Y)[] | keyof Y | undefined) => (keyof Y)[] | keyof Y) | (keyof Y)[] | keyof Y) => void];
19
20
  //#endregion
20
21
  //# sourceMappingURL=index.d.ts.map
@@ -2,8 +2,8 @@ import { StyledProps } from "../../core/components/index.type.js";
2
2
  import "../../core/index.js";
3
3
  import { HTMLAttributes, KeyboardEvent, MouseEvent, Ref } from "react";
4
4
  //#region src/hooks/use-clickable/index.d.ts
5
- type Props<Y extends HTMLElement = HTMLElement> = Omit<HTMLAttributes<Y>, "ref" | "size" | keyof StyledProps>;
6
- export type UseClickableProps<Y extends HTMLElement = HTMLElement, M extends Props<Y> = Props<Y>> = M & {
5
+ export type UseClickableElementProps<Y extends HTMLElement = HTMLElement> = Omit<HTMLAttributes<Y>, "ref" | "size" | keyof StyledProps>;
6
+ export type UseClickableProps<Y extends HTMLElement = HTMLElement, M extends UseClickableElementProps<Y> = UseClickableElementProps<Y>> = M & {
7
7
  /**
8
8
  * Whether or not trigger click on pressing `Enter`.
9
9
  *
@@ -46,7 +46,7 @@ export type UseClickableProps<Y extends HTMLElement = HTMLElement, M extends Pro
46
46
  */
47
47
  ref?: Ref<Y>;
48
48
  };
49
- export declare const useClickable: <Y extends HTMLElement = HTMLElement, M extends Props<Y> = Props<Y>>({ ref, clickOnEnter, clickOnSpace, disabled, disableTouchBehavior, focusable, focusOnClick, tabIndex: tabIndexProp, onClick: onClickProp, onKeyDown: onKeyDownProp, onKeyUp: onKeyUpProp, onMouseDown: onMouseDownProp, onMouseLeave: onMouseLeaveProp, onMouseOver: onMouseOverProp, onMouseUp: onMouseUpProp, ...props }?: UseClickableProps<Y, M>) => (Omit<UseClickableProps<Y, M>, "disabled" | "ref" | "tabIndex" | "onKeyDown" | "onKeyUp" | "onClick" | "onMouseDown" | "onMouseLeave" | "onMouseOver" | "onMouseUp" | "clickOnEnter" | "clickOnSpace" | "disableTouchBehavior" | "focusable" | "focusOnClick"> & {
49
+ export declare const useClickable: <Y extends HTMLElement = HTMLElement, M extends UseClickableElementProps<Y> = UseClickableElementProps<Y>>({ ref, clickOnEnter, clickOnSpace, disabled, disableTouchBehavior, focusable, focusOnClick, tabIndex: tabIndexProp, onClick: onClickProp, onKeyDown: onKeyDownProp, onKeyUp: onKeyUpProp, onMouseDown: onMouseDownProp, onMouseLeave: onMouseLeaveProp, onMouseOver: onMouseOverProp, onMouseUp: onMouseUpProp, ...props }?: UseClickableProps<Y, M>) => (Omit<UseClickableProps<Y, M>, "disabled" | "ref" | "tabIndex" | "onKeyDown" | "onKeyUp" | "onClick" | "onMouseDown" | "onMouseLeave" | "onMouseOver" | "onMouseUp" | "clickOnEnter" | "clickOnSpace" | "disableTouchBehavior" | "focusable" | "focusOnClick"> & {
50
50
  ref: (node: any) => void;
51
51
  type: "button";
52
52
  "aria-disabled": boolean | undefined;
@@ -1,14 +1,14 @@
1
1
  import { Point } from "../../utils/index.js";
2
2
  import { DataAttributes, HTMLAttributes, RefAttributes, RefObject } from "react";
3
3
  //#region src/hooks/use-pan-event/index.d.ts
4
- export interface PanEventProps {
4
+ export interface UsePanEventProps {
5
5
  threshold?: number;
6
6
  onEnd?: (ev: PointerEvent, point: Point, rect: DOMRect) => void;
7
7
  onMove?: (ev: PointerEvent, point: Point, rect: DOMRect) => void;
8
8
  onStart?: (ev: PointerEvent, point: Point, rect: DOMRect) => void;
9
9
  }
10
- interface Props<Y extends HTMLElement> extends DataAttributes, HTMLAttributes<Y>, RefAttributes<Y> {}
11
- export declare const usePanEvent: <Y extends HTMLElement>({ threshold, ...rest }?: PanEventProps) => [RefObject<null | Y>, (props?: Props<Y>) => Props<Y>];
10
+ export interface UsePanEventElementProps<Y extends HTMLElement> extends DataAttributes, HTMLAttributes<Y>, RefAttributes<Y> {}
11
+ export declare const usePanEvent: <Y extends HTMLElement>({ threshold, ...rest }?: UsePanEventProps) => [RefObject<null | Y>, (props?: UsePanEventElementProps<Y>) => UsePanEventElementProps<Y>];
12
12
  export type UsePanEventReturn = ReturnType<typeof usePanEvent>;
13
13
  //#endregion
14
14
  //# sourceMappingURL=index.d.ts.map