aplance-ui 1.0.1

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 (132) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +29 -0
  3. package/dist/api.d.ts +175 -0
  4. package/dist/api.js +1954 -0
  5. package/dist/api.js.map +1 -0
  6. package/dist/frameworks/astro/astro.config.snippet.md +23 -0
  7. package/dist/frameworks/astro/postcss.config.mjs.template +20 -0
  8. package/dist/frameworks/astro/vite-inline.snippet.md +22 -0
  9. package/dist/frameworks/electron-vite/vite.config.snippet.md +44 -0
  10. package/dist/frameworks/next/layout-import.snippet.md +19 -0
  11. package/dist/frameworks/next/next.config.snippet.md +15 -0
  12. package/dist/frameworks/next/postcss.config.js.template +16 -0
  13. package/dist/frameworks/tanstack-start/postcss.config.ts.template +17 -0
  14. package/dist/frameworks/tanstack-start/vite-inline.snippet.md +22 -0
  15. package/dist/frameworks/vite-react/postcss.config.ts.template +16 -0
  16. package/dist/frameworks/vite-react/vite-inline.snippet.md +20 -0
  17. package/dist/frameworks/vite-react/vite.config.ts.template +48 -0
  18. package/dist/index.js +2047 -0
  19. package/dist/index.js.map +1 -0
  20. package/package.json +63 -0
  21. package/registry/components/primitives/icon/icon.module.css +63 -0
  22. package/registry/components/primitives/icon/icon.tsx +53 -0
  23. package/registry/components/primitives/modal/modal-context.ts +19 -0
  24. package/registry/components/primitives/modal/modal.module.css +415 -0
  25. package/registry/components/primitives/modal/modal.tsx +550 -0
  26. package/registry/components/primitives/popover/popover-context.ts +28 -0
  27. package/registry/components/primitives/popover/popover.module.css +28 -0
  28. package/registry/components/primitives/popover/popover.tsx +465 -0
  29. package/registry/components/ui/accordion/accordion.module.css +208 -0
  30. package/registry/components/ui/accordion/accordion.tsx +327 -0
  31. package/registry/components/ui/avatar/avatar.module.css +32 -0
  32. package/registry/components/ui/avatar/avatar.tsx +37 -0
  33. package/registry/components/ui/badge/badge.module.css +103 -0
  34. package/registry/components/ui/badge/badge.tsx +29 -0
  35. package/registry/components/ui/button/button.module.css +216 -0
  36. package/registry/components/ui/button/button.tsx +133 -0
  37. package/registry/components/ui/chart/chart.module.css +168 -0
  38. package/registry/components/ui/chart/chart.tsx +1293 -0
  39. package/registry/components/ui/chart/types.ts +210 -0
  40. package/registry/components/ui/chart/utils.ts +59 -0
  41. package/registry/components/ui/copy-button/copy-button.module.css +21 -0
  42. package/registry/components/ui/copy-button/copy-button.tsx +123 -0
  43. package/registry/components/ui/countdown/countdown.module.css +5 -0
  44. package/registry/components/ui/countdown/countdown.tsx +152 -0
  45. package/registry/components/ui/data-table/checkbox-column.tsx +59 -0
  46. package/registry/components/ui/data-table/data-table.module.css +594 -0
  47. package/registry/components/ui/data-table/data-table.tsx +1109 -0
  48. package/registry/components/ui/data-table/filter-bar.tsx +33 -0
  49. package/registry/components/ui/data-table/pagination-bar.tsx +125 -0
  50. package/registry/components/ui/data-table/types.ts +594 -0
  51. package/registry/components/ui/data-table/useDataTable.tsx +573 -0
  52. package/registry/components/ui/data-table/utils.ts +445 -0
  53. package/registry/components/ui/empty-state/empty-state.module.css +26 -0
  54. package/registry/components/ui/empty-state/empty-state.tsx +32 -0
  55. package/registry/components/ui/input-fields/color-picker/color-palette.module.css +102 -0
  56. package/registry/components/ui/input-fields/color-picker/color-palette.tsx +92 -0
  57. package/registry/components/ui/input-fields/color-picker/color-picker.module.css +29 -0
  58. package/registry/components/ui/input-fields/color-picker/color-picker.tsx +168 -0
  59. package/registry/components/ui/input-fields/common/field-message/field-message.module.css +28 -0
  60. package/registry/components/ui/input-fields/common/field-message/field-message.tsx +39 -0
  61. package/registry/components/ui/input-fields/common/input-field-common.module.css +318 -0
  62. package/registry/components/ui/input-fields/common/input-field-native.module.css +267 -0
  63. package/registry/components/ui/input-fields/common/picker-popover-common.module.css +40 -0
  64. package/registry/components/ui/input-fields/common/select-button/select-button.module.css +9 -0
  65. package/registry/components/ui/input-fields/common/select-button/select-button.tsx +171 -0
  66. package/registry/components/ui/input-fields/common/types.ts +38 -0
  67. package/registry/components/ui/input-fields/custom-select/custom-select.module.css +56 -0
  68. package/registry/components/ui/input-fields/custom-select/custom-select.tsx +403 -0
  69. package/registry/components/ui/input-fields/date-picker/calendar.module.css +311 -0
  70. package/registry/components/ui/input-fields/date-picker/calendar.tsx +186 -0
  71. package/registry/components/ui/input-fields/date-picker/date-picker.module.css +57 -0
  72. package/registry/components/ui/input-fields/date-picker/date-picker.tsx +945 -0
  73. package/registry/components/ui/input-fields/date-picker/types.ts +102 -0
  74. package/registry/components/ui/input-fields/date-picker/utils.ts +236 -0
  75. package/registry/components/ui/input-fields/emoji-picker/emoji-palette.module.css +90 -0
  76. package/registry/components/ui/input-fields/emoji-picker/emoji-palette.tsx +168 -0
  77. package/registry/components/ui/input-fields/emoji-picker/emoji-picker.module.css +8 -0
  78. package/registry/components/ui/input-fields/emoji-picker/emoji-picker.tsx +102 -0
  79. package/registry/components/ui/input-fields/emoji-picker/utils.ts +505 -0
  80. package/registry/components/ui/input-fields/field-group/field-group.module.css +86 -0
  81. package/registry/components/ui/input-fields/field-group/field-group.tsx +86 -0
  82. package/registry/components/ui/input-fields/input/input.tsx +319 -0
  83. package/registry/components/ui/input-fields/media-input/kind-icons.tsx +62 -0
  84. package/registry/components/ui/input-fields/media-input/media-input.module.css +294 -0
  85. package/registry/components/ui/input-fields/media-input/media-input.tsx +327 -0
  86. package/registry/components/ui/input-fields/media-input/media-preview.tsx +101 -0
  87. package/registry/components/ui/input-fields/media-input/types.ts +129 -0
  88. package/registry/components/ui/input-fields/media-input/useMediaUpload.tsx +302 -0
  89. package/registry/components/ui/input-fields/media-input/utils.ts +325 -0
  90. package/registry/components/ui/input-fields/otp-input/otp-input.module.css +24 -0
  91. package/registry/components/ui/input-fields/otp-input/otp-input.tsx +291 -0
  92. package/registry/components/ui/input-fields/select/select.tsx +118 -0
  93. package/registry/components/ui/input-fields/switch/switch.module.css +70 -0
  94. package/registry/components/ui/input-fields/switch/switch.tsx +59 -0
  95. package/registry/components/ui/input-fields/textarea/textarea.tsx +133 -0
  96. package/registry/components/ui/input-fields/time-picker/time-picker.module.css +57 -0
  97. package/registry/components/ui/input-fields/time-picker/time-picker.tsx +437 -0
  98. package/registry/components/ui/loader/loader.module.css +156 -0
  99. package/registry/components/ui/loader/loader.tsx +102 -0
  100. package/registry/components/ui/stepper/stepper.module.css +294 -0
  101. package/registry/components/ui/stepper/stepper.tsx +197 -0
  102. package/registry/components/ui/tabs/tabs.module.css +150 -0
  103. package/registry/components/ui/tabs/tabs.tsx +134 -0
  104. package/registry/components/ui/toast/toast.module.css +159 -0
  105. package/registry/components/ui/toast/toast.tsx +104 -0
  106. package/registry/components/ui/tooltip/tooltip.module.css +82 -0
  107. package/registry/components/ui/tooltip/tooltip.tsx +72 -0
  108. package/registry/global.d.ts +4 -0
  109. package/registry/hooks/useFocusOutside.tsx +33 -0
  110. package/registry/hooks/useResizeObserver.tsx +32 -0
  111. package/registry/lib/dom.ts +25 -0
  112. package/registry/lib/string.ts +23 -0
  113. package/registry/registry.json +719 -0
  114. package/registry/styles/app.css +240 -0
  115. package/registry/styles/components.css +78 -0
  116. package/registry/styles/fonts/geist-regular.woff2 +0 -0
  117. package/registry/styles/globals.css +7 -0
  118. package/registry/styles/media.css +25 -0
  119. package/registry/styles/utilities.css +90 -0
  120. package/registry/themes/colors/blue.css +37 -0
  121. package/registry/themes/colors/green.css +37 -0
  122. package/registry/themes/colors/rose.css +37 -0
  123. package/registry/themes/colors/slate.css +37 -0
  124. package/registry/themes/colors/stone.css +37 -0
  125. package/registry/themes/colors/violet.css +37 -0
  126. package/registry/themes/colors/zinc.css +37 -0
  127. package/registry/themes/radius/pill.css +8 -0
  128. package/registry/themes/radius/rounded.css +8 -0
  129. package/registry/themes/radius/sharp.css +8 -0
  130. package/registry/themes/spacing/compact.css +17 -0
  131. package/registry/themes/spacing/spacious.css +17 -0
  132. package/registry/tsconfig.json +25 -0
@@ -0,0 +1,33 @@
1
+ import { Fragment } from 'react'
2
+ import type { FilterBarProps } from './types'
3
+ import s from './data-table.module.css'
4
+
5
+ /**
6
+ * Headless single-row filter bar.
7
+ * Each field owns its rendering via a render-prop and sets its own grid
8
+ * column width. The bar never wraps - consumers pick widths that fit.
9
+ *
10
+ * Width defaults: input fields → `1fr`, actions → `auto`.
11
+ */
12
+ export const FilterBar = ({ fields, values, onChange }: FilterBarProps) => {
13
+ const gridCols = fields
14
+ .map((f) => f.width ?? (f.type === 'action' ? 'auto' : '1fr'))
15
+ .join(' ')
16
+
17
+ return (
18
+ <div className={s.filter_bar} style={{ gridTemplateColumns: gridCols }}>
19
+ {fields.map((field, i) => (
20
+ <Fragment
21
+ key={field.type === 'action' ? `act:${i}` : `k:${field.key}`}
22
+ >
23
+ {field.type === 'action'
24
+ ? field.render()
25
+ : field.render({
26
+ value: values[field.key] ?? '',
27
+ onChange: (v) => onChange(field.key, v),
28
+ })}
29
+ </Fragment>
30
+ ))}
31
+ </div>
32
+ )
33
+ }
@@ -0,0 +1,125 @@
1
+ import { Button } from '../button/button'
2
+ import { CustomSelect } from '../input-fields/custom-select/custom-select'
3
+ import type { PaginationBarProps } from './types'
4
+ import s from './data-table.module.css'
5
+ import {
6
+ IconChevronLeft,
7
+ IconChevronRight,
8
+ IconChevronsLeft,
9
+ IconChevronsRight,
10
+ } from '@tabler/icons-react'
11
+
12
+ export const PaginationBar = <TData,>({
13
+ table,
14
+ pagination,
15
+ onPaginationChange,
16
+ pageSizeOptions,
17
+ showPageSizeSelect,
18
+ totalCount,
19
+ rowLabel,
20
+ rowsSelectable,
21
+ selectedCount,
22
+ extra,
23
+ }: PaginationBarProps<TData>) => {
24
+ const pageCount = table.getPageCount()
25
+ const total = totalCount ?? table.getRowCount()
26
+ const canPrev = table.getCanPreviousPage()
27
+ const canNext = table.getCanNextPage()
28
+
29
+ const goTo = (i: number) =>
30
+ onPaginationChange({ ...pagination, pageIndex: i })
31
+ const setSize = (size: number) =>
32
+ onPaginationChange({ pageIndex: 0, pageSize: size })
33
+
34
+ // Always show all page size options - current pageSize is guaranteed in the list.
35
+ const sizeOptions = Array.from(
36
+ new Set([...pageSizeOptions, pagination.pageSize]),
37
+ )
38
+ .sort((a, b) => a - b)
39
+ .map((n) => ({ value: String(n), label: String(n) }))
40
+
41
+ return (
42
+ <div className={s.pagination_bar}>
43
+ {/* left - count + optional bulk-action extra slot */}
44
+ <div className={s.pagination_left}>
45
+ <p className={s.pagination_count}>
46
+ {rowsSelectable && selectedCount > 0 ? (
47
+ <>
48
+ <span>{selectedCount}</span> of <span>{total}</span> {rowLabel}(s)
49
+ selected
50
+ </>
51
+ ) : (
52
+ <>
53
+ <span>{total}</span> {rowLabel}(s)
54
+ </>
55
+ )}
56
+ </p>
57
+ {extra}
58
+ </div>
59
+
60
+ {/* right - rows-per-page + page x of y + nav buttons */}
61
+ {pageCount > 0 && (
62
+ <div className={s.pagination_controls}>
63
+ {showPageSizeSelect && (
64
+ <div className={s.page_size_wrap}>
65
+ <span className={s.page_size_label}>{rowLabel}s per page</span>
66
+ <CustomSelect
67
+ options={sizeOptions}
68
+ value={String(pagination.pageSize)}
69
+ popover={{position: "top"}}
70
+ onChange={(val) =>
71
+ setSize(Number(Array.isArray(val) ? val[0] : val))
72
+ }
73
+ selectButton={{ showChevron: true, showClear: false }}
74
+ />
75
+ </div>
76
+ )}
77
+
78
+ <p className={s.page_indicator}>
79
+ Page <span>{pagination.pageIndex + 1}</span> of{' '}
80
+ <span>{pageCount}</span>
81
+ </p>
82
+
83
+ <div className={s.page_nav}>
84
+ <Button
85
+ variant="bordered"
86
+ layout="box"
87
+ onClick={() => goTo(0)}
88
+ disabled={!canPrev}
89
+ aria-label="First page"
90
+ >
91
+ <IconChevronsLeft size={14} stroke={2} />
92
+ </Button>
93
+ <Button
94
+ variant="bordered"
95
+ layout="box"
96
+ onClick={() => goTo(pagination.pageIndex - 1)}
97
+ disabled={!canPrev}
98
+ aria-label="Previous page"
99
+ >
100
+ <IconChevronLeft size={14} stroke={2} />
101
+ </Button>
102
+ <Button
103
+ variant="bordered"
104
+ layout="box"
105
+ onClick={() => goTo(pagination.pageIndex + 1)}
106
+ disabled={!canNext}
107
+ aria-label="Next page"
108
+ >
109
+ <IconChevronRight size={14} stroke={2} />
110
+ </Button>
111
+ <Button
112
+ variant="bordered"
113
+ layout="box"
114
+ onClick={() => goTo(pageCount - 1)}
115
+ disabled={!canNext}
116
+ aria-label="Last page"
117
+ >
118
+ <IconChevronsRight size={14} stroke={2} />
119
+ </Button>
120
+ </div>
121
+ </div>
122
+ )}
123
+ </div>
124
+ )
125
+ }