@linyao.tw/ui 1.0.0 → 1.1.0

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 (175) hide show
  1. package/README.md +9 -1
  2. package/dist/components/date-time/calendar.js +7 -6
  3. package/dist/components/date-time/calendar.js.map +1 -1
  4. package/dist/components/date-time/date-field.js +9 -8
  5. package/dist/components/date-time/date-field.js.map +1 -1
  6. package/dist/components/date-time/date-picker.js +7 -6
  7. package/dist/components/date-time/date-picker.js.map +1 -1
  8. package/dist/components/date-time/date-range-picker.js +7 -6
  9. package/dist/components/date-time/date-range-picker.js.map +1 -1
  10. package/dist/components/date-time/index.js +0 -1
  11. package/dist/components/date-time/shared.d.ts +0 -1
  12. package/dist/components/date-time/shared.js +6 -9
  13. package/dist/components/date-time/shared.js.map +1 -1
  14. package/dist/components/date-time/time-field.js +7 -6
  15. package/dist/components/date-time/time-field.js.map +1 -1
  16. package/dist/components/feedback/alert.js +34 -34
  17. package/dist/components/feedback/alert.js.map +1 -1
  18. package/dist/components/feedback/banner.js +14 -14
  19. package/dist/components/feedback/banner.js.map +1 -1
  20. package/dist/components/feedback/empty-state.d.ts +2 -1
  21. package/dist/components/feedback/empty-state.js +30 -31
  22. package/dist/components/feedback/empty-state.js.map +1 -1
  23. package/dist/components/feedback/feedback.types.d.ts +0 -1
  24. package/dist/components/feedback/feedback.types.js +2 -5
  25. package/dist/components/feedback/feedback.types.js.map +1 -1
  26. package/dist/components/feedback/index.d.ts +8 -8
  27. package/dist/components/feedback/meter.js +20 -21
  28. package/dist/components/feedback/meter.js.map +1 -1
  29. package/dist/components/feedback/progress.js +20 -21
  30. package/dist/components/feedback/progress.js.map +1 -1
  31. package/dist/components/feedback/skeleton.js +10 -11
  32. package/dist/components/feedback/skeleton.js.map +1 -1
  33. package/dist/components/feedback/spinner.js +24 -25
  34. package/dist/components/feedback/spinner.js.map +1 -1
  35. package/dist/components/feedback/toast.js +22 -21
  36. package/dist/components/feedback/toast.js.map +1 -1
  37. package/dist/components/forms/{CodeField.d.ts → code-field.d.ts} +1 -1
  38. package/dist/components/forms/code-field.js +65 -0
  39. package/dist/components/forms/code-field.js.map +1 -0
  40. package/dist/components/forms/{FileUpload.d.ts → file-upload.d.ts} +1 -1
  41. package/dist/components/forms/{FileUpload.js → file-upload.js} +127 -111
  42. package/dist/components/forms/file-upload.js.map +1 -0
  43. package/dist/components/forms/index.d.ts +6 -6
  44. package/dist/components/forms/{Input.js → input.js} +3 -3
  45. package/dist/components/forms/input.js.map +1 -0
  46. package/dist/components/forms/internal.d.ts +0 -2
  47. package/dist/components/forms/internal.js +12 -17
  48. package/dist/components/forms/internal.js.map +1 -1
  49. package/dist/components/forms/number-field.js +73 -0
  50. package/dist/components/forms/number-field.js.map +1 -0
  51. package/dist/components/forms/otp-field.js +57 -0
  52. package/dist/components/forms/otp-field.js.map +1 -0
  53. package/dist/components/forms/{TextField.d.ts → text-field.d.ts} +5 -0
  54. package/dist/components/forms/text-field.js +200 -0
  55. package/dist/components/forms/text-field.js.map +1 -0
  56. package/dist/components/foundations/{Avatar.js → avatar.js} +3 -3
  57. package/dist/components/foundations/avatar.js.map +1 -0
  58. package/dist/components/foundations/{Badge.d.ts → badge.d.ts} +1 -1
  59. package/dist/components/foundations/{Badge.js → badge.js} +3 -3
  60. package/dist/components/foundations/badge.js.map +1 -0
  61. package/dist/components/foundations/{Button.js → button.js} +3 -3
  62. package/dist/components/foundations/button.js.map +1 -0
  63. package/dist/components/foundations/{Card.d.ts → card.d.ts} +9 -2
  64. package/dist/components/foundations/{Card.js → card.js} +5 -5
  65. package/dist/components/foundations/card.js.map +1 -0
  66. package/dist/components/foundations/{IconButton.d.ts → icon-button.d.ts} +2 -8
  67. package/dist/components/foundations/{IconButton.js → icon-button.js} +4 -4
  68. package/dist/components/foundations/icon-button.js.map +1 -0
  69. package/dist/components/foundations/index.d.ts +9 -9
  70. package/dist/components/foundations/{Link.d.ts → link.d.ts} +1 -1
  71. package/dist/components/foundations/link.js +46 -0
  72. package/dist/components/foundations/link.js.map +1 -0
  73. package/dist/components/foundations/{ListCell.d.ts → list-cell.d.ts} +1 -8
  74. package/dist/components/foundations/{ListCell.js → list-cell.js} +3 -3
  75. package/dist/components/foundations/list-cell.js.map +1 -0
  76. package/dist/components/foundations/{SectionHeading.d.ts → section-heading.d.ts} +5 -2
  77. package/dist/components/foundations/{SectionHeading.js → section-heading.js} +3 -3
  78. package/dist/components/foundations/section-heading.js.map +1 -0
  79. package/dist/components/foundations/{Separator.js → separator.js} +3 -3
  80. package/dist/components/foundations/separator.js.map +1 -0
  81. package/dist/components/navigation-data/breadcrumb-pagination.js +88 -81
  82. package/dist/components/navigation-data/breadcrumb-pagination.js.map +1 -1
  83. package/dist/components/navigation-data/command-palette.d.ts +26 -0
  84. package/dist/components/navigation-data/command-palette.js +100 -72
  85. package/dist/components/navigation-data/command-palette.js.map +1 -1
  86. package/dist/components/navigation-data/header-tab-bar.js +49 -46
  87. package/dist/components/navigation-data/header-tab-bar.js.map +1 -1
  88. package/dist/components/navigation-data/index.d.ts +7 -7
  89. package/dist/components/navigation-data/menubar-toolbar.js +1 -1
  90. package/dist/components/navigation-data/menubar-toolbar.js.map +1 -1
  91. package/dist/components/navigation-data/navigation-menu.js +1 -1
  92. package/dist/components/navigation-data/navigation-menu.js.map +1 -1
  93. package/dist/components/navigation-data/scroll-area.js +1 -1
  94. package/dist/components/navigation-data/scroll-area.js.map +1 -1
  95. package/dist/components/navigation-data/table-collection.d.ts +12 -3
  96. package/dist/components/navigation-data/table-collection.js +11 -9
  97. package/dist/components/navigation-data/table-collection.js.map +1 -1
  98. package/dist/components/overlays/dialog.d.ts +13 -2
  99. package/dist/components/overlays/dialog.js +136 -131
  100. package/dist/components/overlays/dialog.js.map +1 -1
  101. package/dist/components/overlays/disclosure.js +1 -1
  102. package/dist/components/overlays/disclosure.js.map +1 -1
  103. package/dist/components/overlays/drawer.d.ts +5 -1
  104. package/dist/components/overlays/drawer.js +156 -152
  105. package/dist/components/overlays/drawer.js.map +1 -1
  106. package/dist/components/overlays/floating.js +115 -113
  107. package/dist/components/overlays/floating.js.map +1 -1
  108. package/dist/components/overlays/index.d.ts +4 -4
  109. package/dist/components/selection/combobox.js +93 -93
  110. package/dist/components/selection/combobox.js.map +1 -1
  111. package/dist/components/selection/controls.d.ts +4 -1
  112. package/dist/components/selection/controls.js +140 -118
  113. package/dist/components/selection/controls.js.map +1 -1
  114. package/dist/components/selection/menu.js +120 -121
  115. package/dist/components/selection/menu.js.map +1 -1
  116. package/dist/components/selection/select.js +107 -107
  117. package/dist/components/selection/select.js.map +1 -1
  118. package/dist/fonts.css +13 -0
  119. package/dist/index.d.ts +1 -0
  120. package/dist/index.js +37 -33
  121. package/dist/internal/accessible-name.d.ts +12 -0
  122. package/dist/internal/class-names.d.ts +12 -0
  123. package/dist/{components/selection/classnames.js → internal/class-names.js} +3 -3
  124. package/dist/internal/class-names.js.map +1 -0
  125. package/dist/internal/index.d.ts +3 -0
  126. package/dist/{components/foundations/shared.d.ts → internal/render.d.ts} +2 -1
  127. package/dist/intl/index.d.ts +2 -0
  128. package/dist/intl/messages.d.ts +48 -0
  129. package/dist/intl/messages.js +80 -0
  130. package/dist/intl/messages.js.map +1 -0
  131. package/dist/intl/provider.d.ts +18 -0
  132. package/dist/intl/provider.js +22 -0
  133. package/dist/intl/provider.js.map +1 -0
  134. package/dist/styles.css +1 -1
  135. package/package.json +6 -4
  136. package/dist/components/feedback/feedback.module.js +0 -42
  137. package/dist/components/feedback/feedback.module.js.map +0 -1
  138. package/dist/components/forms/CodeField.js +0 -63
  139. package/dist/components/forms/CodeField.js.map +0 -1
  140. package/dist/components/forms/FileUpload.js.map +0 -1
  141. package/dist/components/forms/Input.js.map +0 -1
  142. package/dist/components/forms/NumberField.js +0 -71
  143. package/dist/components/forms/NumberField.js.map +0 -1
  144. package/dist/components/forms/OTPField.js +0 -54
  145. package/dist/components/forms/OTPField.js.map +0 -1
  146. package/dist/components/forms/TextField.js +0 -199
  147. package/dist/components/forms/TextField.js.map +0 -1
  148. package/dist/components/foundations/Avatar.js.map +0 -1
  149. package/dist/components/foundations/Badge.js.map +0 -1
  150. package/dist/components/foundations/Button.js.map +0 -1
  151. package/dist/components/foundations/Card.js.map +0 -1
  152. package/dist/components/foundations/IconButton.js.map +0 -1
  153. package/dist/components/foundations/Link.js +0 -40
  154. package/dist/components/foundations/Link.js.map +0 -1
  155. package/dist/components/foundations/ListCell.js.map +0 -1
  156. package/dist/components/foundations/SectionHeading.js.map +0 -1
  157. package/dist/components/foundations/Separator.js.map +0 -1
  158. package/dist/components/foundations/shared.js +0 -8
  159. package/dist/components/foundations/shared.js.map +0 -1
  160. package/dist/components/navigation-data/utils.d.ts +0 -2
  161. package/dist/components/navigation-data/utils.js +0 -11
  162. package/dist/components/navigation-data/utils.js.map +0 -1
  163. package/dist/components/overlays/class-names.d.ts +0 -6
  164. package/dist/components/overlays/class-names.js +0 -11
  165. package/dist/components/overlays/class-names.js.map +0 -1
  166. package/dist/components/selection/classnames.d.ts +0 -4
  167. package/dist/components/selection/classnames.js.map +0 -1
  168. package/dist/components/selection/selection.module.js +0 -51
  169. package/dist/components/selection/selection.module.js.map +0 -1
  170. /package/dist/components/forms/{Input.d.ts → input.d.ts} +0 -0
  171. /package/dist/components/forms/{NumberField.d.ts → number-field.d.ts} +0 -0
  172. /package/dist/components/forms/{OTPField.d.ts → otp-field.d.ts} +0 -0
  173. /package/dist/components/foundations/{Avatar.d.ts → avatar.d.ts} +0 -0
  174. /package/dist/components/foundations/{Button.d.ts → button.d.ts} +0 -0
  175. /package/dist/components/foundations/{Separator.d.ts → separator.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"disclosure.js","names":[],"sources":["../../../src/components/overlays/disclosure.tsx"],"sourcesContent":["import {\n\tAccordion as BaseAccordion,\n\ttype AccordionHeaderProps,\n\ttype AccordionItemProps,\n\ttype AccordionPanelProps,\n\ttype AccordionRootProps,\n\ttype AccordionTriggerProps\n} from \"@base-ui/react/accordion\";\nimport { Collapsible as BaseCollapsible, type CollapsiblePanelProps, type CollapsibleRootProps, type CollapsibleTriggerProps } from \"@base-ui/react/collapsible\";\nimport { Tabs as BaseTabs, type TabsIndicatorProps, type TabsListProps, type TabsPanelProps, type TabsRootProps, type TabsTabProps } from \"@base-ui/react/tabs\";\nimport { CaretDownIcon } from \"@phosphor-icons/react/dist/csr/CaretDown\";\nimport { forwardRef, type JSX } from \"react\";\n\nimport { mergeClassName } from \"./class-names\";\n\nexport type { AccordionRootChangeEventDetails } from \"@base-ui/react/accordion\";\nexport type { CollapsibleRootChangeEventDetails } from \"@base-ui/react/collapsible\";\nexport type { TabsRootChangeEventDetails } from \"@base-ui/react/tabs\";\n\nexport function AccordionRoot<Value = string>(props: AccordionRootProps<Value>): JSX.Element {\n\tconst { className, ...rootProps } = props;\n\n\treturn <BaseAccordion.Root {...rootProps} className={mergeClassName(\"lyds-accordion\", className)} />;\n}\n\nexport const AccordionItem = forwardRef<HTMLDivElement, AccordionItemProps>(function AccordionItem({ className, ...props }, ref) {\n\treturn <BaseAccordion.Item {...props} ref={ref} className={mergeClassName(\"lyds-accordion__item\", className)} />;\n});\n\nexport const AccordionHeader = forwardRef<HTMLHeadingElement, AccordionHeaderProps>(function AccordionHeader({ className, ...props }, ref) {\n\treturn <BaseAccordion.Header {...props} ref={ref} className={mergeClassName(\"lyds-accordion__header\", className)} />;\n});\n\nexport const AccordionTrigger = forwardRef<HTMLElement, AccordionTriggerProps>(function AccordionTrigger({ children, className, ...props }, ref) {\n\treturn (\n\t\t<BaseAccordion.Trigger {...props} ref={ref} className={mergeClassName(\"lyds-accordion__trigger\", className)}>\n\t\t\t<span className=\"lyds-accordion__label\">{children}</span>\n\t\t\t<span className=\"lyds-accordion__indicator\" aria-hidden=\"true\">\n\t\t\t\t<CaretDownIcon aria-hidden=\"true\" weight=\"bold\" />\n\t\t\t</span>\n\t\t</BaseAccordion.Trigger>\n\t);\n});\n\nexport const AccordionPanel = forwardRef<HTMLDivElement, AccordionPanelProps>(function AccordionPanel({ children, className, ...props }, ref) {\n\treturn (\n\t\t<BaseAccordion.Panel {...props} ref={ref} className={mergeClassName(\"lyds-accordion__panel\", className)}>\n\t\t\t<div className=\"lyds-accordion__panelContent\">{children}</div>\n\t\t</BaseAccordion.Panel>\n\t);\n});\n\nexport const Accordion = {\n\tRoot: AccordionRoot,\n\tItem: AccordionItem,\n\tHeader: AccordionHeader,\n\tTrigger: AccordionTrigger,\n\tPanel: AccordionPanel\n} as const;\n\nexport const CollapsibleRoot = forwardRef<HTMLDivElement, CollapsibleRootProps>(function CollapsibleRoot({ className, ...props }, ref) {\n\treturn <BaseCollapsible.Root {...props} ref={ref} className={mergeClassName(\"lyds-collapsible\", className)} />;\n});\n\nexport const CollapsibleTrigger = forwardRef<HTMLButtonElement, CollapsibleTriggerProps>(function CollapsibleTrigger({ children, className, ...props }, ref) {\n\treturn (\n\t\t<BaseCollapsible.Trigger {...props} ref={ref} className={mergeClassName(\"lyds-collapsible__trigger\", className)}>\n\t\t\t<span className=\"lyds-collapsible__label\">{children}</span>\n\t\t\t<span className=\"lyds-collapsible__indicator\" aria-hidden=\"true\">\n\t\t\t\t<CaretDownIcon aria-hidden=\"true\" weight=\"bold\" />\n\t\t\t</span>\n\t\t</BaseCollapsible.Trigger>\n\t);\n});\n\nexport const CollapsiblePanel = forwardRef<HTMLDivElement, CollapsiblePanelProps>(function CollapsiblePanel({ children, className, ...props }, ref) {\n\treturn (\n\t\t<BaseCollapsible.Panel {...props} ref={ref} className={mergeClassName(\"lyds-collapsible__panel\", className)}>\n\t\t\t<div className=\"lyds-collapsible__panelContent\">{children}</div>\n\t\t</BaseCollapsible.Panel>\n\t);\n});\n\nexport const Collapsible = {\n\tRoot: CollapsibleRoot,\n\tTrigger: CollapsibleTrigger,\n\tPanel: CollapsiblePanel\n} as const;\n\nexport const TabsRoot = forwardRef<HTMLDivElement, TabsRootProps>(function TabsRoot({ className, ...props }, ref) {\n\treturn <BaseTabs.Root {...props} ref={ref} className={mergeClassName(\"lyds-tabs\", className)} />;\n});\n\nexport const TabsList = forwardRef<HTMLDivElement, TabsListProps>(function TabsList({ className, ...props }, ref) {\n\treturn <BaseTabs.List {...props} ref={ref} className={mergeClassName(\"lyds-tabs__list\", className)} />;\n});\n\nexport const TabsTab = forwardRef<HTMLElement, TabsTabProps>(function TabsTab({ className, ...props }, ref) {\n\treturn <BaseTabs.Tab {...props} ref={ref} className={mergeClassName(\"lyds-tabs__tab\", className)} />;\n});\n\n/** Base UI 指示器的進階自訂介面。作用中的分頁已有自身選取樣式,因此 Linyao Design System 預設隱藏此元件。 */\nexport const TabsIndicator = forwardRef<HTMLSpanElement, TabsIndicatorProps>(function TabsIndicator({ className, ...props }, ref) {\n\treturn <BaseTabs.Indicator {...props} ref={ref} className={mergeClassName(\"lyds-tabs__indicator\", className)} />;\n});\n\nexport const TabsPanel = forwardRef<HTMLDivElement, TabsPanelProps>(function TabsPanel({ className, ...props }, ref) {\n\treturn <BaseTabs.Panel {...props} ref={ref} className={mergeClassName(\"lyds-tabs__panel\", className)} />;\n});\n\nexport const Tabs = {\n\tRoot: TabsRoot,\n\tList: TabsList,\n\tTab: TabsTab,\n\tIndicator: TabsIndicator,\n\tPanel: TabsPanel\n} as const;\n"],"mappings":";;;;;;;;AAmBA,SAAgB,EAA8B,GAA+C;CAC5F,IAAM,EAAE,cAAW,GAAG,MAAc;CAEpC,OAAO,kBAAC,EAAc,MAAf;EAAoB,GAAI;EAAW,WAAW,EAAe,kBAAkB,CAAS;CAAI,CAAA;AACpG;AAEA,IAAa,IAAgB,EAA+C,SAAuB,EAAE,cAAW,GAAG,KAAS,GAAK;CAChI,OAAO,kBAAC,EAAc,MAAf;EAAoB,GAAI;EAAY;EAAK,WAAW,EAAe,wBAAwB,CAAS;CAAI,CAAA;AAChH,CAAC,GAEY,IAAkB,EAAqD,SAAyB,EAAE,cAAW,GAAG,KAAS,GAAK;CAC1I,OAAO,kBAAC,EAAc,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../../../src/components/overlays/disclosure.tsx"],"sourcesContent":["import {\n\tAccordion as BaseAccordion,\n\ttype AccordionHeaderProps,\n\ttype AccordionItemProps,\n\ttype AccordionPanelProps,\n\ttype AccordionRootProps,\n\ttype AccordionTriggerProps\n} from \"@base-ui/react/accordion\";\nimport { Collapsible as BaseCollapsible, type CollapsiblePanelProps, type CollapsibleRootProps, type CollapsibleTriggerProps } from \"@base-ui/react/collapsible\";\nimport { Tabs as BaseTabs, type TabsIndicatorProps, type TabsListProps, type TabsPanelProps, type TabsRootProps, type TabsTabProps } from \"@base-ui/react/tabs\";\nimport { CaretDownIcon } from \"@phosphor-icons/react/dist/csr/CaretDown\";\nimport { forwardRef, type JSX } from \"react\";\n\nimport { withStateClassName } from \"@/internal\";\nexport type { AccordionRootChangeEventDetails } from \"@base-ui/react/accordion\";\nexport type { CollapsibleRootChangeEventDetails } from \"@base-ui/react/collapsible\";\nexport type { TabsRootChangeEventDetails } from \"@base-ui/react/tabs\";\n\nexport function AccordionRoot<Value = string>(props: AccordionRootProps<Value>): JSX.Element {\n\tconst { className, ...rootProps } = props;\n\n\treturn <BaseAccordion.Root {...rootProps} className={withStateClassName(\"lyds-accordion\", className)} />;\n}\n\nexport const AccordionItem = forwardRef<HTMLDivElement, AccordionItemProps>(function AccordionItem({ className, ...props }, ref) {\n\treturn <BaseAccordion.Item {...props} ref={ref} className={withStateClassName(\"lyds-accordion__item\", className)} />;\n});\n\nexport const AccordionHeader = forwardRef<HTMLHeadingElement, AccordionHeaderProps>(function AccordionHeader({ className, ...props }, ref) {\n\treturn <BaseAccordion.Header {...props} ref={ref} className={withStateClassName(\"lyds-accordion__header\", className)} />;\n});\n\nexport const AccordionTrigger = forwardRef<HTMLElement, AccordionTriggerProps>(function AccordionTrigger({ children, className, ...props }, ref) {\n\treturn (\n\t\t<BaseAccordion.Trigger {...props} ref={ref} className={withStateClassName(\"lyds-accordion__trigger\", className)}>\n\t\t\t<span className=\"lyds-accordion__label\">{children}</span>\n\t\t\t<span className=\"lyds-accordion__indicator\" aria-hidden=\"true\">\n\t\t\t\t<CaretDownIcon aria-hidden=\"true\" weight=\"bold\" />\n\t\t\t</span>\n\t\t</BaseAccordion.Trigger>\n\t);\n});\n\nexport const AccordionPanel = forwardRef<HTMLDivElement, AccordionPanelProps>(function AccordionPanel({ children, className, ...props }, ref) {\n\treturn (\n\t\t<BaseAccordion.Panel {...props} ref={ref} className={withStateClassName(\"lyds-accordion__panel\", className)}>\n\t\t\t<div className=\"lyds-accordion__panelContent\">{children}</div>\n\t\t</BaseAccordion.Panel>\n\t);\n});\n\nexport const Accordion = {\n\tRoot: AccordionRoot,\n\tItem: AccordionItem,\n\tHeader: AccordionHeader,\n\tTrigger: AccordionTrigger,\n\tPanel: AccordionPanel\n} as const;\n\nexport const CollapsibleRoot = forwardRef<HTMLDivElement, CollapsibleRootProps>(function CollapsibleRoot({ className, ...props }, ref) {\n\treturn <BaseCollapsible.Root {...props} ref={ref} className={withStateClassName(\"lyds-collapsible\", className)} />;\n});\n\nexport const CollapsibleTrigger = forwardRef<HTMLButtonElement, CollapsibleTriggerProps>(function CollapsibleTrigger({ children, className, ...props }, ref) {\n\treturn (\n\t\t<BaseCollapsible.Trigger {...props} ref={ref} className={withStateClassName(\"lyds-collapsible__trigger\", className)}>\n\t\t\t<span className=\"lyds-collapsible__label\">{children}</span>\n\t\t\t<span className=\"lyds-collapsible__indicator\" aria-hidden=\"true\">\n\t\t\t\t<CaretDownIcon aria-hidden=\"true\" weight=\"bold\" />\n\t\t\t</span>\n\t\t</BaseCollapsible.Trigger>\n\t);\n});\n\nexport const CollapsiblePanel = forwardRef<HTMLDivElement, CollapsiblePanelProps>(function CollapsiblePanel({ children, className, ...props }, ref) {\n\treturn (\n\t\t<BaseCollapsible.Panel {...props} ref={ref} className={withStateClassName(\"lyds-collapsible__panel\", className)}>\n\t\t\t<div className=\"lyds-collapsible__panelContent\">{children}</div>\n\t\t</BaseCollapsible.Panel>\n\t);\n});\n\nexport const Collapsible = {\n\tRoot: CollapsibleRoot,\n\tTrigger: CollapsibleTrigger,\n\tPanel: CollapsiblePanel\n} as const;\n\nexport const TabsRoot = forwardRef<HTMLDivElement, TabsRootProps>(function TabsRoot({ className, ...props }, ref) {\n\treturn <BaseTabs.Root {...props} ref={ref} className={withStateClassName(\"lyds-tabs\", className)} />;\n});\n\nexport const TabsList = forwardRef<HTMLDivElement, TabsListProps>(function TabsList({ className, ...props }, ref) {\n\treturn <BaseTabs.List {...props} ref={ref} className={withStateClassName(\"lyds-tabs__list\", className)} />;\n});\n\nexport const TabsTab = forwardRef<HTMLElement, TabsTabProps>(function TabsTab({ className, ...props }, ref) {\n\treturn <BaseTabs.Tab {...props} ref={ref} className={withStateClassName(\"lyds-tabs__tab\", className)} />;\n});\n\n/** Base UI 指示器的進階自訂介面。作用中的分頁已有自身選取樣式,因此 Linyao Design System 預設隱藏此元件。 */\nexport const TabsIndicator = forwardRef<HTMLSpanElement, TabsIndicatorProps>(function TabsIndicator({ className, ...props }, ref) {\n\treturn <BaseTabs.Indicator {...props} ref={ref} className={withStateClassName(\"lyds-tabs__indicator\", className)} />;\n});\n\nexport const TabsPanel = forwardRef<HTMLDivElement, TabsPanelProps>(function TabsPanel({ className, ...props }, ref) {\n\treturn <BaseTabs.Panel {...props} ref={ref} className={withStateClassName(\"lyds-tabs__panel\", className)} />;\n});\n\nexport const Tabs = {\n\tRoot: TabsRoot,\n\tList: TabsList,\n\tTab: TabsTab,\n\tIndicator: TabsIndicator,\n\tPanel: TabsPanel\n} as const;\n"],"mappings":";;;;;;;;AAkBA,SAAgB,EAA8B,GAA+C;CAC5F,IAAM,EAAE,cAAW,GAAG,MAAc;CAEpC,OAAO,kBAAC,EAAc,MAAf;EAAoB,GAAI;EAAW,WAAW,EAAmB,kBAAkB,CAAS;CAAI,CAAA;AACxG;AAEA,IAAa,IAAgB,EAA+C,SAAuB,EAAE,cAAW,GAAG,KAAS,GAAK;CAChI,OAAO,kBAAC,EAAc,MAAf;EAAoB,G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AAK,WAAW,EAAmB,oBAAoB,CAAS;CAAI,CAAA;AAC5G,CAAC,GAEY,IAAO;CACnB,MAAM;CACN,MAAM;CACN,KAAK;CACL,WAAW;CACX,OAAO;AACR"}
@@ -11,7 +11,11 @@ export interface DrawerPopupProps extends BaseDrawerPopupProps {
11
11
  closeLabel?: string;
12
12
  /** 傳給內建關閉控制項的屬性。 */
13
13
  closeProps?: Omit<DrawerCloseProps, "children">;
14
- /** 僅在彈出內容另有可存取的 Drawer.Close 時設定。 */
14
+ /** Renders the built-in corner close control. */
15
+ closeButton?: boolean;
16
+ /**
17
+ * @deprecated Pass `closeButton={false}` instead. Kept so existing call sites keep working.
18
+ */
15
19
  hasCustomClose?: boolean;
16
20
  }
17
21
  export declare const DrawerPopup: import('react').ForwardRefExoticComponent<Omit<DrawerPopupProps, "ref"> & RefAttributes<HTMLDivElement>>;
@@ -1,192 +1,196 @@
1
- import { mergeClassName as e } from "./class-names.js";
2
- import { forwardRef as t } from "react";
3
- import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
- import { XIcon as i } from "@phosphor-icons/react/dist/csr/X";
5
- import { Drawer as a } from "@base-ui/react/drawer";
1
+ import { cx as e, withStateClassName as t } from "../../internal/class-names.js";
2
+ import { useMessages as n } from "../../intl/provider.js";
3
+ import { forwardRef as r } from "react";
4
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
5
+ import { XIcon as o } from "@phosphor-icons/react/dist/csr/X";
6
+ import { Drawer as s } from "@base-ui/react/drawer";
6
7
  //#region src/components/overlays/drawer.tsx
7
- function o() {
8
- return /* @__PURE__ */ n(i, {
8
+ function c() {
9
+ return /* @__PURE__ */ i(o, {
9
10
  "aria-hidden": "true",
10
11
  className: "lyds-overlayClose__glyph",
11
12
  weight: "bold"
12
13
  });
13
14
  }
14
- function s({ swipeDirection: e = "right", ...t }) {
15
- return /* @__PURE__ */ n(a.Root, {
15
+ function l({ swipeDirection: e = "right", ...t }) {
16
+ return /* @__PURE__ */ i(s.Root, {
16
17
  ...t,
17
18
  swipeDirection: e
18
19
  });
19
20
  }
20
- function c({ className: t, ...r }) {
21
- return /* @__PURE__ */ n(a.Trigger, {
22
- ...r,
23
- className: e("lyds-drawer__trigger", t)
21
+ function u({ className: e, ...n }) {
22
+ return /* @__PURE__ */ i(s.Trigger, {
23
+ ...n,
24
+ className: t("lyds-drawer__trigger", e)
24
25
  });
25
26
  }
26
- var l = t(function(e, t) {
27
- return /* @__PURE__ */ n(a.Portal, {
27
+ var d = r(function(e, t) {
28
+ return /* @__PURE__ */ i(s.Portal, {
28
29
  ...e,
29
30
  ref: t
30
31
  });
31
- }), u = t(function({ className: t, ...r }, i) {
32
- return /* @__PURE__ */ n(a.Backdrop, {
33
- ...r,
34
- ref: i,
35
- className: e("lyds-drawer__backdrop", t)
32
+ }), f = r(function({ className: e, ...n }, r) {
33
+ return /* @__PURE__ */ i(s.Backdrop, {
34
+ ...n,
35
+ ref: r,
36
+ className: t("lyds-drawer__backdrop", e)
37
+ });
38
+ }), p = r(function({ className: e, ...n }, r) {
39
+ return /* @__PURE__ */ i(s.Viewport, {
40
+ ...n,
41
+ ref: r,
42
+ className: t("lyds-drawer__viewport", e)
43
+ });
44
+ }), m = r(function({ children: e, className: r, closeButton: o, closeLabel: c, closeProps: l, hasCustomClose: u = !1, ...d }, f) {
45
+ let p = n(), m = o ?? !u;
46
+ return /* @__PURE__ */ a(s.Popup, {
47
+ ...d,
48
+ ref: f,
49
+ className: t("lyds-drawer__popup", r),
50
+ children: [m ? /* @__PURE__ */ i(v, {
51
+ ...l,
52
+ "aria-label": c ?? p.drawerClose
53
+ }) : null, e]
54
+ });
55
+ }), h = r(function({ className: e, ...n }, r) {
56
+ return /* @__PURE__ */ i(s.Content, {
57
+ ...n,
58
+ ref: r,
59
+ className: t("lyds-drawer__content", e)
60
+ });
61
+ }), g = r(function({ className: e, ...n }, r) {
62
+ return /* @__PURE__ */ i(s.Title, {
63
+ ...n,
64
+ ref: r,
65
+ className: t("lyds-drawer__title", e)
36
66
  });
37
- }), d = t(function({ className: t, ...r }, i) {
38
- return /* @__PURE__ */ n(a.Viewport, {
39
- ...r,
40
- ref: i,
41
- className: e("lyds-drawer__viewport", t)
67
+ }), _ = r(function({ className: e, ...n }, r) {
68
+ return /* @__PURE__ */ i(s.Description, {
69
+ ...n,
70
+ ref: r,
71
+ className: t("lyds-drawer__description", e)
42
72
  });
43
- }), f = t(function({ children: t, className: i, closeLabel: o = "關閉側欄", closeProps: s, hasCustomClose: c = !1, ...l }, u) {
44
- return /* @__PURE__ */ r(a.Popup, {
73
+ }), v = r(function({ "aria-label": e, children: r, className: a, variant: o = r == null ? "icon" : "action", ...l }, u) {
74
+ let d = n();
75
+ return /* @__PURE__ */ i(s.Close, {
45
76
  ...l,
46
77
  ref: u,
47
- className: e("lyds-drawer__popup", i),
48
- children: [t, c ? null : /* @__PURE__ */ n(g, {
49
- ...s,
50
- "aria-label": o
51
- })]
52
- });
53
- }), p = t(function({ className: t, ...r }, i) {
54
- return /* @__PURE__ */ n(a.Content, {
55
- ...r,
56
- ref: i,
57
- className: e("lyds-drawer__content", t)
58
- });
59
- }), m = t(function({ className: t, ...r }, i) {
60
- return /* @__PURE__ */ n(a.Title, {
61
- ...r,
62
- ref: i,
63
- className: e("lyds-drawer__title", t)
64
- });
65
- }), h = t(function({ className: t, ...r }, i) {
66
- return /* @__PURE__ */ n(a.Description, {
67
- ...r,
68
- ref: i,
69
- className: e("lyds-drawer__description", t)
70
- });
71
- }), g = t(function({ "aria-label": t, children: r, className: i, variant: s = r == null ? "icon" : "action", ...c }, l) {
72
- return /* @__PURE__ */ n(a.Close, {
73
- ...c,
74
- ref: l,
75
- "aria-label": t ?? (r == null ? "關閉側欄" : void 0),
76
- className: e(s === "icon" ? "lyds-overlayClose" : "lyds-overlayCloseAction", i),
77
- children: r ?? /* @__PURE__ */ n(o, {})
78
- });
79
- }), _ = t(function({ className: t, ...r }, i) {
80
- return /* @__PURE__ */ n(a.SwipeArea, {
81
- ...r,
82
- ref: i,
83
- className: e("lyds-drawer__swipeArea", t)
84
- });
85
- }), v = t(function({ className: e, ...t }, r) {
86
- return /* @__PURE__ */ n("div", {
87
- ...t,
78
+ "aria-label": e ?? (r == null ? d.drawerClose : void 0),
79
+ className: t(o === "icon" ? "lyds-overlayClose" : "lyds-overlayCloseAction", a),
80
+ children: r ?? /* @__PURE__ */ i(c, {})
81
+ });
82
+ }), y = r(function({ className: e, ...n }, r) {
83
+ return /* @__PURE__ */ i(s.SwipeArea, {
84
+ ...n,
88
85
  ref: r,
89
- className: e ? `lyds-drawer__header ${e}` : "lyds-drawer__header"
86
+ className: t("lyds-drawer__swipeArea", e)
90
87
  });
91
- }), y = t(function({ className: e, ...t }, r) {
92
- return /* @__PURE__ */ n("div", {
93
- ...t,
88
+ }), b = r(function({ className: t, ...n }, r) {
89
+ return /* @__PURE__ */ i("div", {
90
+ ...n,
94
91
  ref: r,
95
- className: e ? `lyds-drawer__body ${e}` : "lyds-drawer__body"
92
+ className: e("lyds-drawer__header", t)
96
93
  });
97
- }), b = t(function({ className: e, ...t }, r) {
98
- return /* @__PURE__ */ n("div", {
99
- ...t,
94
+ }), x = r(function({ className: t, ...n }, r) {
95
+ return /* @__PURE__ */ i("div", {
96
+ ...n,
97
+ ref: r,
98
+ className: e("lyds-drawer__body", t)
99
+ });
100
+ }), S = r(function({ className: t, ...n }, r) {
101
+ return /* @__PURE__ */ i("div", {
102
+ ...n,
100
103
  ref: r,
101
- className: e ? `lyds-drawer__footer ${e}` : "lyds-drawer__footer"
102
- });
103
- }), x = {
104
- Root: s,
105
- Trigger: c,
106
- Portal: l,
107
- Backdrop: u,
108
- Viewport: d,
109
- Popup: f,
110
- Content: p,
111
- Header: v,
112
- Body: y,
113
- Footer: b,
114
- Title: m,
115
- Description: h,
116
- Close: g,
117
- SwipeArea: _,
118
- Provider: a.Provider,
119
- Indent: a.Indent,
120
- IndentBackground: a.IndentBackground,
121
- VirtualKeyboardProvider: a.VirtualKeyboardProvider,
122
- createHandle: a.createHandle,
123
- Handle: a.Handle
124
- }, S = [.45, .92];
125
- function C({ snapPoints: e = S, defaultSnapPoint: t, ...r }) {
126
- let i = e.at(-1) ?? null;
127
- return /* @__PURE__ */ n(a.Root, {
128
- ...r,
104
+ className: e("lyds-drawer__footer", t)
105
+ });
106
+ }), C = {
107
+ Root: l,
108
+ Trigger: u,
109
+ Portal: d,
110
+ Backdrop: f,
111
+ Viewport: p,
112
+ Popup: m,
113
+ Content: h,
114
+ Header: b,
115
+ Body: x,
116
+ Footer: S,
117
+ Title: g,
118
+ Description: _,
119
+ Close: v,
120
+ SwipeArea: y,
121
+ Provider: s.Provider,
122
+ Indent: s.Indent,
123
+ IndentBackground: s.IndentBackground,
124
+ VirtualKeyboardProvider: s.VirtualKeyboardProvider,
125
+ createHandle: s.createHandle,
126
+ Handle: s.Handle
127
+ }, w = [.45, .92];
128
+ function T({ snapPoints: e = w, defaultSnapPoint: t, ...n }) {
129
+ let r = e.at(-1) ?? null;
130
+ return /* @__PURE__ */ i(s.Root, {
131
+ ...n,
129
132
  swipeDirection: "down",
130
133
  snapPoints: e,
131
- defaultSnapPoint: t ?? i
134
+ defaultSnapPoint: t ?? r
132
135
  });
133
136
  }
134
- var w = t(function({ children: t, className: i, closeLabel: o = "關閉底部面板", closeProps: s, hasCustomClose: c = !1, ...l }, u) {
135
- return /* @__PURE__ */ r(a.Popup, {
136
- ...l,
137
- ref: u,
138
- className: e("lyds-drawer__popup lyds-bottomSheet__popup", i),
139
- children: [t, c ? null : /* @__PURE__ */ n(g, {
140
- ...s,
141
- "aria-label": o
142
- })]
143
- });
144
- }), T = t(function({ className: e, ...t }, r) {
145
- return /* @__PURE__ */ n("div", {
146
- ...t,
137
+ var E = r(function({ children: e, className: r, closeButton: o, closeLabel: c, closeProps: l, hasCustomClose: u = !1, ...d }, f) {
138
+ let p = n(), m = o ?? !u;
139
+ return /* @__PURE__ */ a(s.Popup, {
140
+ ...d,
141
+ ref: f,
142
+ className: t("lyds-drawer__popup lyds-bottomSheet__popup", r),
143
+ children: [m ? /* @__PURE__ */ i(v, {
144
+ ...l,
145
+ "aria-label": c ?? p.bottomSheetClose
146
+ }) : null, e]
147
+ });
148
+ }), D = r(function({ className: t, ...n }, r) {
149
+ return /* @__PURE__ */ i("div", {
150
+ ...n,
147
151
  ref: r,
148
152
  "aria-hidden": "true",
149
- className: e ? `lyds-bottomSheet__handle ${e}` : "lyds-bottomSheet__handle",
150
- children: /* @__PURE__ */ n("span", { className: "lyds-bottomSheet__handleBar" })
153
+ className: e("lyds-bottomSheet__handle", t),
154
+ children: /* @__PURE__ */ i("span", { className: "lyds-bottomSheet__handleBar" })
151
155
  });
152
- }), E = t(function({ className: e, ...t }, r) {
153
- return /* @__PURE__ */ n("div", {
154
- ...t,
156
+ }), O = r(function({ className: t, ...n }, r) {
157
+ return /* @__PURE__ */ i("div", {
158
+ ...n,
155
159
  ref: r,
156
- className: e ? `lyds-drawer__header lyds-bottomSheet__header ${e}` : "lyds-drawer__header lyds-bottomSheet__header"
160
+ className: e("lyds-drawer__header lyds-bottomSheet__header", t)
157
161
  });
158
- }), D = t(function({ className: e, ...t }, r) {
159
- return /* @__PURE__ */ n("div", {
160
- ...t,
162
+ }), k = r(function({ className: t, ...n }, r) {
163
+ return /* @__PURE__ */ i("div", {
164
+ ...n,
161
165
  ref: r,
162
- className: e ? `lyds-drawer__body lyds-bottomSheet__body ${e}` : "lyds-drawer__body lyds-bottomSheet__body"
166
+ className: e("lyds-drawer__body lyds-bottomSheet__body", t)
163
167
  });
164
- }), O = t(function({ className: e, ...t }, r) {
165
- return /* @__PURE__ */ n("div", {
166
- ...t,
168
+ }), A = r(function({ className: t, ...n }, r) {
169
+ return /* @__PURE__ */ i("div", {
170
+ ...n,
167
171
  ref: r,
168
- className: e ? `lyds-drawer__footer lyds-bottomSheet__footer ${e}` : "lyds-drawer__footer lyds-bottomSheet__footer"
169
- });
170
- }), k = {
171
- Root: C,
172
- Trigger: c,
173
- Portal: l,
174
- Backdrop: u,
175
- Viewport: d,
176
- Popup: w,
177
- Content: p,
178
- Handle: T,
179
- Header: E,
180
- Body: D,
181
- Footer: O,
182
- Title: m,
183
- Description: h,
184
- Close: g,
185
- SwipeArea: _,
186
- createHandle: a.createHandle,
187
- ImperativeHandle: a.Handle
172
+ className: e("lyds-drawer__footer lyds-bottomSheet__footer", t)
173
+ });
174
+ }), j = {
175
+ Root: T,
176
+ Trigger: u,
177
+ Portal: d,
178
+ Backdrop: f,
179
+ Viewport: p,
180
+ Popup: E,
181
+ Content: h,
182
+ Handle: D,
183
+ Header: O,
184
+ Body: k,
185
+ Footer: A,
186
+ Title: g,
187
+ Description: _,
188
+ Close: v,
189
+ SwipeArea: y,
190
+ createHandle: s.createHandle,
191
+ ImperativeHandle: s.Handle
188
192
  };
189
193
  //#endregion
190
- export { k as BottomSheet, D as BottomSheetBody, O as BottomSheetFooter, T as BottomSheetHandle, E as BottomSheetHeader, w as BottomSheetPopup, C as BottomSheetRoot, x as Drawer, u as DrawerBackdrop, y as DrawerBody, g as DrawerClose, p as DrawerContent, h as DrawerDescription, b as DrawerFooter, v as DrawerHeader, f as DrawerPopup, l as DrawerPortal, s as DrawerRoot, _ as DrawerSwipeArea, m as DrawerTitle, c as DrawerTrigger, d as DrawerViewport };
194
+ export { j as BottomSheet, k as BottomSheetBody, A as BottomSheetFooter, D as BottomSheetHandle, O as BottomSheetHeader, E as BottomSheetPopup, T as BottomSheetRoot, C as Drawer, f as DrawerBackdrop, x as DrawerBody, v as DrawerClose, h as DrawerContent, _ as DrawerDescription, S as DrawerFooter, b as DrawerHeader, m as DrawerPopup, d as DrawerPortal, l as DrawerRoot, y as DrawerSwipeArea, g as DrawerTitle, u as DrawerTrigger, p as DrawerViewport };
191
195
 
192
196
  //# sourceMappingURL=drawer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"drawer.js","names":[],"sources":["../../../src/components/overlays/drawer.tsx"],"sourcesContent":["import {\n\tDrawer as BaseDrawer,\n\ttype DrawerCloseProps as BaseDrawerCloseProps,\n\ttype DrawerPopupProps as BaseDrawerPopupProps,\n\ttype DrawerBackdropProps,\n\ttype DrawerContentProps,\n\ttype DrawerDescriptionProps,\n\ttype DrawerPortalProps,\n\ttype DrawerRootProps,\n\ttype DrawerSwipeAreaProps,\n\ttype DrawerTitleProps,\n\ttype DrawerTriggerProps,\n\ttype DrawerViewportProps\n} from \"@base-ui/react/drawer\";\nimport { XIcon } from \"@phosphor-icons/react/dist/csr/X\";\nimport { forwardRef, type HTMLAttributes, type JSX, type RefAttributes } from \"react\";\n\nimport { mergeClassName } from \"./class-names\";\n\nexport type { DrawerRootChangeEventDetails } from \"@base-ui/react/drawer\";\n\nfunction CloseGlyph(): JSX.Element {\n\treturn <XIcon aria-hidden=\"true\" className=\"lyds-overlayClose__glyph\" weight=\"bold\" />;\n}\n\nexport function DrawerRoot<Payload = unknown>({ swipeDirection = \"right\", ...props }: DrawerRootProps<Payload>): JSX.Element {\n\treturn <BaseDrawer.Root {...props} swipeDirection={swipeDirection} />;\n}\n\nexport function DrawerTrigger<Payload = unknown>({ className, ...props }: DrawerTriggerProps<Payload> & RefAttributes<HTMLElement>): JSX.Element {\n\treturn <BaseDrawer.Trigger {...props} className={mergeClassName(\"lyds-drawer__trigger\", className)} />;\n}\n\nexport const DrawerPortal = forwardRef<HTMLDivElement, DrawerPortalProps>(function DrawerPortal(props, ref) {\n\treturn <BaseDrawer.Portal {...props} ref={ref} />;\n});\n\nexport const DrawerBackdrop = forwardRef<HTMLDivElement, DrawerBackdropProps>(function DrawerBackdrop({ className, ...props }, ref) {\n\treturn <BaseDrawer.Backdrop {...props} ref={ref} className={mergeClassName(\"lyds-drawer__backdrop\", className)} />;\n});\n\nexport const DrawerViewport = forwardRef<HTMLDivElement, DrawerViewportProps>(function DrawerViewport({ className, ...props }, ref) {\n\treturn <BaseDrawer.Viewport {...props} ref={ref} className={mergeClassName(\"lyds-drawer__viewport\", className)} />;\n});\n\nexport interface DrawerPopupProps extends BaseDrawerPopupProps {\n\t/** 內建關閉控制項的無障礙標籤。 */\n\tcloseLabel?: string;\n\t/** 傳給內建關閉控制項的屬性。 */\n\tcloseProps?: Omit<DrawerCloseProps, \"children\">;\n\t/** 僅在彈出內容另有可存取的 Drawer.Close 時設定。 */\n\thasCustomClose?: boolean;\n}\n\nexport const DrawerPopup = forwardRef<HTMLDivElement, DrawerPopupProps>(function DrawerPopup({ children, className, closeLabel = \"關閉側欄\", closeProps, hasCustomClose = false, ...props }, ref) {\n\treturn (\n\t\t<BaseDrawer.Popup {...props} ref={ref} className={mergeClassName(\"lyds-drawer__popup\", className)}>\n\t\t\t{children}\n\t\t\t{hasCustomClose ? null : <DrawerClose {...closeProps} aria-label={closeLabel} />}\n\t\t</BaseDrawer.Popup>\n\t);\n});\n\nexport const DrawerContent = forwardRef<HTMLDivElement, DrawerContentProps>(function DrawerContent({ className, ...props }, ref) {\n\treturn <BaseDrawer.Content {...props} ref={ref} className={mergeClassName(\"lyds-drawer__content\", className)} />;\n});\n\nexport const DrawerTitle = forwardRef<HTMLHeadingElement, DrawerTitleProps>(function DrawerTitle({ className, ...props }, ref) {\n\treturn <BaseDrawer.Title {...props} ref={ref} className={mergeClassName(\"lyds-drawer__title\", className)} />;\n});\n\nexport const DrawerDescription = forwardRef<HTMLParagraphElement, DrawerDescriptionProps>(function DrawerDescription({ className, ...props }, ref) {\n\treturn <BaseDrawer.Description {...props} ref={ref} className={mergeClassName(\"lyds-drawer__description\", className)} />;\n});\n\nexport interface DrawerCloseProps extends BaseDrawerCloseProps {\n\t/** 圖示控制項位於面板角落;動作控制項則參與內容排版。 */\n\tvariant?: \"icon\" | \"action\";\n}\n\nexport const DrawerClose = forwardRef<HTMLButtonElement, DrawerCloseProps>(function DrawerClose(\n\t{ \"aria-label\": ariaLabel, children, className, variant = children == null ? \"icon\" : \"action\", ...props },\n\tref\n) {\n\treturn (\n\t\t<BaseDrawer.Close\n\t\t\t{...props}\n\t\t\tref={ref}\n\t\t\taria-label={ariaLabel ?? (children == null ? \"關閉側欄\" : undefined)}\n\t\t\tclassName={mergeClassName(variant === \"icon\" ? \"lyds-overlayClose\" : \"lyds-overlayCloseAction\", className)}\n\t\t>\n\t\t\t{children ?? <CloseGlyph />}\n\t\t</BaseDrawer.Close>\n\t);\n});\n\nexport const DrawerSwipeArea = forwardRef<HTMLDivElement, DrawerSwipeAreaProps>(function DrawerSwipeArea({ className, ...props }, ref) {\n\treturn <BaseDrawer.SwipeArea {...props} ref={ref} className={mergeClassName(\"lyds-drawer__swipeArea\", className)} />;\n});\n\nexport type DrawerHeaderProps = HTMLAttributes<HTMLDivElement>;\n\nexport const DrawerHeader = forwardRef<HTMLDivElement, DrawerHeaderProps>(function DrawerHeader({ className, ...props }, ref) {\n\treturn <div {...props} ref={ref} className={className ? `lyds-drawer__header ${className}` : \"lyds-drawer__header\"} />;\n});\n\nexport type DrawerBodyProps = HTMLAttributes<HTMLDivElement>;\n\nexport const DrawerBody = forwardRef<HTMLDivElement, DrawerBodyProps>(function DrawerBody({ className, ...props }, ref) {\n\treturn <div {...props} ref={ref} className={className ? `lyds-drawer__body ${className}` : \"lyds-drawer__body\"} />;\n});\n\nexport type DrawerFooterProps = HTMLAttributes<HTMLDivElement>;\n\nexport const DrawerFooter = forwardRef<HTMLDivElement, DrawerFooterProps>(function DrawerFooter({ className, ...props }, ref) {\n\treturn <div {...props} ref={ref} className={className ? `lyds-drawer__footer ${className}` : \"lyds-drawer__footer\"} />;\n});\n\nexport const Drawer = {\n\tRoot: DrawerRoot,\n\tTrigger: DrawerTrigger,\n\tPortal: DrawerPortal,\n\tBackdrop: DrawerBackdrop,\n\tViewport: DrawerViewport,\n\tPopup: DrawerPopup,\n\tContent: DrawerContent,\n\tHeader: DrawerHeader,\n\tBody: DrawerBody,\n\tFooter: DrawerFooter,\n\tTitle: DrawerTitle,\n\tDescription: DrawerDescription,\n\tClose: DrawerClose,\n\tSwipeArea: DrawerSwipeArea,\n\tProvider: BaseDrawer.Provider,\n\tIndent: BaseDrawer.Indent,\n\tIndentBackground: BaseDrawer.IndentBackground,\n\tVirtualKeyboardProvider: BaseDrawer.VirtualKeyboardProvider,\n\tcreateHandle: BaseDrawer.createHandle,\n\tHandle: BaseDrawer.Handle\n} as const;\n\nexport type BottomSheetSnapPoint = number | `${number}rem`;\n\nexport interface BottomSheetRootProps<Payload = unknown> extends Omit<DrawerRootProps<Payload>, \"snapPoints\" | \"swipeDirection\"> {\n\t/** 響應式面板建議使用 0 至 1 的比例值或 rem 長度。 */\n\tsnapPoints?: BottomSheetSnapPoint[];\n\t/** 底部面板一律向下關閉。 */\n\tswipeDirection?: \"down\";\n}\n\nconst defaultBottomSheetSnapPoints: BottomSheetSnapPoint[] = [0.45, 0.92];\n\nexport function BottomSheetRoot<Payload = unknown>({ snapPoints = defaultBottomSheetSnapPoints, defaultSnapPoint, ...props }: BottomSheetRootProps<Payload>): JSX.Element {\n\tconst accessibleDefaultSnapPoint = snapPoints.at(-1) ?? null;\n\treturn <BaseDrawer.Root {...props} swipeDirection=\"down\" snapPoints={snapPoints} defaultSnapPoint={defaultSnapPoint ?? accessibleDefaultSnapPoint} />;\n}\n\nexport const BottomSheetPopup = forwardRef<HTMLDivElement, DrawerPopupProps>(function BottomSheetPopup(\n\t{ children, className, closeLabel = \"關閉底部面板\", closeProps, hasCustomClose = false, ...props },\n\tref\n) {\n\treturn (\n\t\t<BaseDrawer.Popup {...props} ref={ref} className={mergeClassName(\"lyds-drawer__popup lyds-bottomSheet__popup\", className)}>\n\t\t\t{children}\n\t\t\t{hasCustomClose ? null : <DrawerClose {...closeProps} aria-label={closeLabel} />}\n\t\t</BaseDrawer.Popup>\n\t);\n});\n\nexport type BottomSheetHandleProps = HTMLAttributes<HTMLDivElement>;\n\n/** 符合觸控尺寸的裝飾性操作提示;滑動行為仍由 Base UI 負責。 */\nexport const BottomSheetHandle = forwardRef<HTMLDivElement, BottomSheetHandleProps>(function BottomSheetHandle({ className, ...props }, ref) {\n\treturn (\n\t\t<div {...props} ref={ref} aria-hidden=\"true\" className={className ? `lyds-bottomSheet__handle ${className}` : \"lyds-bottomSheet__handle\"}>\n\t\t\t<span className=\"lyds-bottomSheet__handleBar\" />\n\t\t</div>\n\t);\n});\n\nexport const BottomSheetHeader = forwardRef<HTMLDivElement, DrawerHeaderProps>(function BottomSheetHeader({ className, ...props }, ref) {\n\treturn <div {...props} ref={ref} className={className ? `lyds-drawer__header lyds-bottomSheet__header ${className}` : \"lyds-drawer__header lyds-bottomSheet__header\"} />;\n});\n\nexport const BottomSheetBody = forwardRef<HTMLDivElement, DrawerBodyProps>(function BottomSheetBody({ className, ...props }, ref) {\n\treturn <div {...props} ref={ref} className={className ? `lyds-drawer__body lyds-bottomSheet__body ${className}` : \"lyds-drawer__body lyds-bottomSheet__body\"} />;\n});\n\nexport const BottomSheetFooter = forwardRef<HTMLDivElement, DrawerFooterProps>(function BottomSheetFooter({ className, ...props }, ref) {\n\treturn <div {...props} ref={ref} className={className ? `lyds-drawer__footer lyds-bottomSheet__footer ${className}` : \"lyds-drawer__footer lyds-bottomSheet__footer\"} />;\n});\n\nexport const BottomSheet = {\n\tRoot: BottomSheetRoot,\n\tTrigger: DrawerTrigger,\n\tPortal: DrawerPortal,\n\tBackdrop: DrawerBackdrop,\n\tViewport: DrawerViewport,\n\tPopup: BottomSheetPopup,\n\tContent: DrawerContent,\n\tHandle: BottomSheetHandle,\n\tHeader: BottomSheetHeader,\n\tBody: BottomSheetBody,\n\tFooter: BottomSheetFooter,\n\tTitle: DrawerTitle,\n\tDescription: DrawerDescription,\n\tClose: DrawerClose,\n\tSwipeArea: DrawerSwipeArea,\n\tcreateHandle: BaseDrawer.createHandle,\n\tImperativeHandle: BaseDrawer.Handle\n} as const;\n"],"mappings":";;;;;;AAqBA,SAAS,IAA0B;CAClC,OAAO,kBAAC,GAAD;EAAO,eAAY;EAAO,WAAU;EAA2B,QAAO;CAAQ,CAAA;AACtF;AAEA,SAAgB,EAA8B,EAAE,oBAAiB,SAAS,GAAG,KAA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AAC,OAAD;EAAK,GAAI;EAAY;EAAK,WAAW,IAAY,4CAA4C,MAAc;CAA6C,CAAA;AAChK,CAAC,GAEY,IAAoB,EAA8C,SAA2B,EAAE,cAAW,GAAG,KAAS,GAAK;CACvI,OAAO,kBAAC,OAAD;EAAK,GAAI;EAAY;EAAK,WAAW,IAAY,gDAAgD,MAAc;CAAiD,CAAA;AACxK,CAAC,GAEY,IAAc;CAC1B,MAAM;CACN,SAAS;CACT,QAAQ;CACR,UAAU;CACV,UAAU;CACV,OAAO;CACP,SAAS;CACT,QAAQ;CACR,QAAQ;CACR,MAAM;CACN,QAAQ;CACR,OAAO;CACP,aAAa;CACb,OAAO;CACP,WAAW;CACX,cAAc,EAAW;CACzB,kBAAkB,EAAW;AAC9B"}
1
+ {"version":3,"file":"drawer.js","names":[],"sources":["../../../src/components/overlays/drawer.tsx"],"sourcesContent":["import {\n\tDrawer as BaseDrawer,\n\ttype DrawerCloseProps as BaseDrawerCloseProps,\n\ttype DrawerPopupProps as BaseDrawerPopupProps,\n\ttype DrawerBackdropProps,\n\ttype DrawerContentProps,\n\ttype DrawerDescriptionProps,\n\ttype DrawerPortalProps,\n\ttype DrawerRootProps,\n\ttype DrawerSwipeAreaProps,\n\ttype DrawerTitleProps,\n\ttype DrawerTriggerProps,\n\ttype DrawerViewportProps\n} from \"@base-ui/react/drawer\";\nimport { XIcon } from \"@phosphor-icons/react/dist/csr/X\";\nimport { forwardRef, type HTMLAttributes, type JSX, type RefAttributes } from \"react\";\n\nimport { cx, withStateClassName } from \"@/internal\";\nimport { useMessages } from \"@/intl\";\nexport type { DrawerRootChangeEventDetails } from \"@base-ui/react/drawer\";\n\nfunction CloseGlyph(): JSX.Element {\n\treturn <XIcon aria-hidden=\"true\" className=\"lyds-overlayClose__glyph\" weight=\"bold\" />;\n}\n\nexport function DrawerRoot<Payload = unknown>({ swipeDirection = \"right\", ...props }: DrawerRootProps<Payload>): JSX.Element {\n\treturn <BaseDrawer.Root {...props} swipeDirection={swipeDirection} />;\n}\n\nexport function DrawerTrigger<Payload = unknown>({ className, ...props }: DrawerTriggerProps<Payload> & RefAttributes<HTMLElement>): JSX.Element {\n\treturn <BaseDrawer.Trigger {...props} className={withStateClassName(\"lyds-drawer__trigger\", className)} />;\n}\n\nexport const DrawerPortal = forwardRef<HTMLDivElement, DrawerPortalProps>(function DrawerPortal(props, ref) {\n\treturn <BaseDrawer.Portal {...props} ref={ref} />;\n});\n\nexport const DrawerBackdrop = forwardRef<HTMLDivElement, DrawerBackdropProps>(function DrawerBackdrop({ className, ...props }, ref) {\n\treturn <BaseDrawer.Backdrop {...props} ref={ref} className={withStateClassName(\"lyds-drawer__backdrop\", className)} />;\n});\n\nexport const DrawerViewport = forwardRef<HTMLDivElement, DrawerViewportProps>(function DrawerViewport({ className, ...props }, ref) {\n\treturn <BaseDrawer.Viewport {...props} ref={ref} className={withStateClassName(\"lyds-drawer__viewport\", className)} />;\n});\n\nexport interface DrawerPopupProps extends BaseDrawerPopupProps {\n\t/** 內建關閉控制項的無障礙標籤。 */\n\tcloseLabel?: string;\n\t/** 傳給內建關閉控制項的屬性。 */\n\tcloseProps?: Omit<DrawerCloseProps, \"children\">;\n\t/** Renders the built-in corner close control. */\n\tcloseButton?: boolean;\n\t/**\n\t * @deprecated Pass `closeButton={false}` instead. Kept so existing call sites keep working.\n\t */\n\thasCustomClose?: boolean;\n}\n\nexport const DrawerPopup = forwardRef<HTMLDivElement, DrawerPopupProps>(function DrawerPopup({ children, className, closeButton, closeLabel, closeProps, hasCustomClose = false, ...props }, ref) {\n\tconst messages = useMessages();\n\tconst showCloseButton = closeButton ?? !hasCustomClose;\n\n\treturn (\n\t\t<BaseDrawer.Popup {...props} ref={ref} className={withStateClassName(\"lyds-drawer__popup\", className)}>\n\t\t\t{showCloseButton ? <DrawerClose {...closeProps} aria-label={closeLabel ?? messages.drawerClose} /> : null}\n\t\t\t{children}\n\t\t</BaseDrawer.Popup>\n\t);\n});\n\nexport const DrawerContent = forwardRef<HTMLDivElement, DrawerContentProps>(function DrawerContent({ className, ...props }, ref) {\n\treturn <BaseDrawer.Content {...props} ref={ref} className={withStateClassName(\"lyds-drawer__content\", className)} />;\n});\n\nexport const DrawerTitle = forwardRef<HTMLHeadingElement, DrawerTitleProps>(function DrawerTitle({ className, ...props }, ref) {\n\treturn <BaseDrawer.Title {...props} ref={ref} className={withStateClassName(\"lyds-drawer__title\", className)} />;\n});\n\nexport const DrawerDescription = forwardRef<HTMLParagraphElement, DrawerDescriptionProps>(function DrawerDescription({ className, ...props }, ref) {\n\treturn <BaseDrawer.Description {...props} ref={ref} className={withStateClassName(\"lyds-drawer__description\", className)} />;\n});\n\nexport interface DrawerCloseProps extends BaseDrawerCloseProps {\n\t/** 圖示控制項位於面板角落;動作控制項則參與內容排版。 */\n\tvariant?: \"icon\" | \"action\";\n}\n\nexport const DrawerClose = forwardRef<HTMLButtonElement, DrawerCloseProps>(function DrawerClose(\n\t{ \"aria-label\": ariaLabel, children, className, variant = children == null ? \"icon\" : \"action\", ...props },\n\tref\n) {\n\tconst messages = useMessages();\n\n\treturn (\n\t\t<BaseDrawer.Close\n\t\t\t{...props}\n\t\t\tref={ref}\n\t\t\taria-label={ariaLabel ?? (children == null ? messages.drawerClose : undefined)}\n\t\t\tclassName={withStateClassName(variant === \"icon\" ? \"lyds-overlayClose\" : \"lyds-overlayCloseAction\", className)}\n\t\t>\n\t\t\t{children ?? <CloseGlyph />}\n\t\t</BaseDrawer.Close>\n\t);\n});\n\nexport const DrawerSwipeArea = forwardRef<HTMLDivElement, DrawerSwipeAreaProps>(function DrawerSwipeArea({ className, ...props }, ref) {\n\treturn <BaseDrawer.SwipeArea {...props} ref={ref} className={withStateClassName(\"lyds-drawer__swipeArea\", className)} />;\n});\n\nexport type DrawerHeaderProps = HTMLAttributes<HTMLDivElement>;\n\nexport const DrawerHeader = forwardRef<HTMLDivElement, DrawerHeaderProps>(function DrawerHeader({ className, ...props }, ref) {\n\treturn <div {...props} ref={ref} className={cx(\"lyds-drawer__header\", className)} />;\n});\n\nexport type DrawerBodyProps = HTMLAttributes<HTMLDivElement>;\n\nexport const DrawerBody = forwardRef<HTMLDivElement, DrawerBodyProps>(function DrawerBody({ className, ...props }, ref) {\n\treturn <div {...props} ref={ref} className={cx(\"lyds-drawer__body\", className)} />;\n});\n\nexport type DrawerFooterProps = HTMLAttributes<HTMLDivElement>;\n\nexport const DrawerFooter = forwardRef<HTMLDivElement, DrawerFooterProps>(function DrawerFooter({ className, ...props }, ref) {\n\treturn <div {...props} ref={ref} className={cx(\"lyds-drawer__footer\", className)} />;\n});\n\nexport const Drawer = {\n\tRoot: DrawerRoot,\n\tTrigger: DrawerTrigger,\n\tPortal: DrawerPortal,\n\tBackdrop: DrawerBackdrop,\n\tViewport: DrawerViewport,\n\tPopup: DrawerPopup,\n\tContent: DrawerContent,\n\tHeader: DrawerHeader,\n\tBody: DrawerBody,\n\tFooter: DrawerFooter,\n\tTitle: DrawerTitle,\n\tDescription: DrawerDescription,\n\tClose: DrawerClose,\n\tSwipeArea: DrawerSwipeArea,\n\tProvider: BaseDrawer.Provider,\n\tIndent: BaseDrawer.Indent,\n\tIndentBackground: BaseDrawer.IndentBackground,\n\tVirtualKeyboardProvider: BaseDrawer.VirtualKeyboardProvider,\n\tcreateHandle: BaseDrawer.createHandle,\n\tHandle: BaseDrawer.Handle\n} as const;\n\nexport type BottomSheetSnapPoint = number | `${number}rem`;\n\nexport interface BottomSheetRootProps<Payload = unknown> extends Omit<DrawerRootProps<Payload>, \"snapPoints\" | \"swipeDirection\"> {\n\t/** 響應式面板建議使用 0 至 1 的比例值或 rem 長度。 */\n\tsnapPoints?: BottomSheetSnapPoint[];\n\t/** 底部面板一律向下關閉。 */\n\tswipeDirection?: \"down\";\n}\n\nconst defaultBottomSheetSnapPoints: BottomSheetSnapPoint[] = [0.45, 0.92];\n\nexport function BottomSheetRoot<Payload = unknown>({ snapPoints = defaultBottomSheetSnapPoints, defaultSnapPoint, ...props }: BottomSheetRootProps<Payload>): JSX.Element {\n\tconst accessibleDefaultSnapPoint = snapPoints.at(-1) ?? null;\n\treturn <BaseDrawer.Root {...props} swipeDirection=\"down\" snapPoints={snapPoints} defaultSnapPoint={defaultSnapPoint ?? accessibleDefaultSnapPoint} />;\n}\n\nexport const BottomSheetPopup = forwardRef<HTMLDivElement, DrawerPopupProps>(function BottomSheetPopup(\n\t{ children, className, closeButton, closeLabel, closeProps, hasCustomClose = false, ...props },\n\tref\n) {\n\tconst messages = useMessages();\n\tconst showCloseButton = closeButton ?? !hasCustomClose;\n\n\treturn (\n\t\t<BaseDrawer.Popup {...props} ref={ref} className={withStateClassName(\"lyds-drawer__popup lyds-bottomSheet__popup\", className)}>\n\t\t\t{showCloseButton ? <DrawerClose {...closeProps} aria-label={closeLabel ?? messages.bottomSheetClose} /> : null}\n\t\t\t{children}\n\t\t</BaseDrawer.Popup>\n\t);\n});\n\nexport type BottomSheetHandleProps = HTMLAttributes<HTMLDivElement>;\n\n/** 符合觸控尺寸的裝飾性操作提示;滑動行為仍由 Base UI 負責。 */\nexport const BottomSheetHandle = forwardRef<HTMLDivElement, BottomSheetHandleProps>(function BottomSheetHandle({ className, ...props }, ref) {\n\treturn (\n\t\t<div {...props} ref={ref} aria-hidden=\"true\" className={cx(\"lyds-bottomSheet__handle\", className)}>\n\t\t\t<span className=\"lyds-bottomSheet__handleBar\" />\n\t\t</div>\n\t);\n});\n\nexport const BottomSheetHeader = forwardRef<HTMLDivElement, DrawerHeaderProps>(function BottomSheetHeader({ className, ...props }, ref) {\n\treturn <div {...props} ref={ref} className={cx(\"lyds-drawer__header lyds-bottomSheet__header\", className)} />;\n});\n\nexport const BottomSheetBody = forwardRef<HTMLDivElement, DrawerBodyProps>(function BottomSheetBody({ className, ...props }, ref) {\n\treturn <div {...props} ref={ref} className={cx(\"lyds-drawer__body lyds-bottomSheet__body\", className)} />;\n});\n\nexport const BottomSheetFooter = forwardRef<HTMLDivElement, DrawerFooterProps>(function BottomSheetFooter({ className, ...props }, ref) {\n\treturn <div {...props} ref={ref} className={cx(\"lyds-drawer__footer lyds-bottomSheet__footer\", className)} />;\n});\n\nexport const BottomSheet = {\n\tRoot: BottomSheetRoot,\n\tTrigger: DrawerTrigger,\n\tPortal: DrawerPortal,\n\tBackdrop: DrawerBackdrop,\n\tViewport: DrawerViewport,\n\tPopup: BottomSheetPopup,\n\tContent: DrawerContent,\n\tHandle: BottomSheetHandle,\n\tHeader: BottomSheetHeader,\n\tBody: BottomSheetBody,\n\tFooter: BottomSheetFooter,\n\tTitle: DrawerTitle,\n\tDescription: DrawerDescription,\n\tClose: DrawerClose,\n\tSwipeArea: DrawerSwipeArea,\n\tcreateHandle: BaseDrawer.createHandle,\n\tImperativeHandle: BaseDrawer.Handle\n} as const;\n"],"mappings":";;;;;;;AAqBA,SAAS,IAA0B;CAClC,OAAO,kBAAC,GAAD;EAAO,eAAY;EAAO,WAAU;EAA2B,QAAO;CAAQ,CAAA;AACtF;AAEA,SAAgB,EAA8B,EAAE,oBAAiB,SAAS,GAAG,KAAgD;CAC5H,OAAO,kBAAC,EAAW,MAAZ;EAAiB,GAAI;EAAuB;CAAiB,CAAA;AACrE;AAEA,SAAgB,EAAiC,EAAE,cAAW,GAAG,KAAgF;CAChJ,OAAO,kBAAC,EAAW,SAAZ;EAAoB,GAAI;EAAO,WAAW,EAAmB,wBAAwB,CAAS;CAAI,CAAA;AAC1G;AAEA,IAAa,IAAe,EAA8C,SAAsB,GAAO,GAAK;CAC3G,OAAO,kBAAC,EAAW,QAAZ;EAAmB,GAAI;EAAY;CAAM,CAAA;AACjD,CAAC,GAEY,IAAiB,EAAgD,SAAwB,EAAE,cAAW,GAAG,KAAS,GAAK;CACnI,OAAO,kBAAC,EAAW,UAAZ;EAAqB,GAAI;EAAY;EAAK,WAAW,EAAmB,yBAAyB,CAAS;CAAI,CAAA;AACtH,CAAC,GAEY,IAAiB,EAAgD,SAAwB,EAAE,cAAW,GAAG,KAAS,GAAK;CACnI,OAAO,kBAAC,EAAW,U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