@12-apps/ui 1.6.3 → 1.8.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 (39) hide show
  1. package/package.json +4 -4
  2. package/src/components/data-display/DataViews/DataViewsTableBase.tsx +1 -1
  3. package/src/components/data-display/DataViews/RESPONSIVE-BEHAVIOUR.md +183 -0
  4. package/src/components/data-display/DataViews/base-card.tsx +93 -23
  5. package/src/components/data-display/DataViews/base-list-card-slots.tsx +256 -0
  6. package/src/components/data-display/DataViews/base-list-card.tsx +352 -0
  7. package/src/components/data-display/DataViews/card-surface.ts +297 -0
  8. package/src/components/data-display/DataViews/data-views-bar-controls.tsx +119 -0
  9. package/src/components/data-display/DataViews/data-views-display-panel.tsx +48 -22
  10. package/src/components/data-display/DataViews/data-views-display-tabs.tsx +64 -31
  11. package/src/components/data-display/DataViews/data-views-drag.tsx +135 -0
  12. package/src/components/data-display/DataViews/data-views-export.tsx +2 -1
  13. package/src/components/data-display/DataViews/data-views-glyphs.tsx +16 -0
  14. package/src/components/data-display/DataViews/data-views-grid-bodies.tsx +5 -1
  15. package/src/components/data-display/DataViews/data-views-grid-parts.tsx +20 -14
  16. package/src/components/data-display/DataViews/data-views-inline-bar.tsx +134 -155
  17. package/src/components/data-display/DataViews/data-views-layout-context.tsx +21 -0
  18. package/src/components/data-display/DataViews/data-views-more-fields.tsx +291 -0
  19. package/src/components/data-display/DataViews/data-views-more-filters.tsx +151 -199
  20. package/src/components/data-display/DataViews/data-views-overflow-costs.ts +100 -0
  21. package/src/components/data-display/DataViews/data-views-overflow.ts +89 -73
  22. package/src/components/data-display/DataViews/data-views-preset-chips.tsx +100 -0
  23. package/src/components/data-display/DataViews/data-views-range-pill.tsx +27 -11
  24. package/src/components/data-display/DataViews/data-views-range-presets.ts +121 -0
  25. package/src/components/data-display/DataViews/data-views-range-types.ts +94 -0
  26. package/src/components/data-display/DataViews/data-views-scope-tabs.tsx +57 -0
  27. package/src/components/data-display/DataViews/data-views-scopes.tsx +2 -2
  28. package/src/components/data-display/DataViews/data-views-search.tsx +19 -1
  29. package/src/components/data-display/DataViews/data-views-shell-toolbar.tsx +4 -0
  30. package/src/components/data-display/DataViews/data-views-toolbar.tsx +31 -21
  31. package/src/components/data-display/DataViews/data-views-types.ts +14 -47
  32. package/src/components/data-display/DataViews/index.ts +8 -0
  33. package/src/components/data-display/DataViews/list-card-rails.tsx +141 -0
  34. package/src/components/data-display/DataViews/pedidos.server.ts +118 -0
  35. package/src/components/data-display/DataViews/use-data-views-state.ts +1 -1
  36. package/src/components/data-display/DescriptionItem/DescriptionItem.tsx +26 -3
  37. package/src/components/layout/ContentToolbar/ContentToolbar.tsx +16 -1
  38. package/src/components/layout/ContentToolbar/MultiSelectDropdown.tsx +9 -1
  39. package/src/components/layout/ContentToolbar/MultiSelectTriggers.tsx +39 -1
@@ -1,5 +1,6 @@
1
1
  'use client';
2
2
 
3
+ import CloseIcon from '@mui/icons-material/Close';
3
4
  import ChevronDownIcon from '@mui/icons-material/KeyboardArrowDown';
4
5
  import { Box, Button, Typography } from '@mui/material';
5
6
  import React, { useId } from 'react';
@@ -107,7 +108,8 @@ export function PillTrigger({
107
108
  onOpen,
108
109
  testId,
109
110
  selectedCount,
110
- }: TriggerProps & { selectedCount: number }): React.JSX.Element {
111
+ onClear,
112
+ }: TriggerProps & { selectedCount: number; onClear?: () => void }): React.JSX.Element {
111
113
  const active = selectedCount > 0;
112
114
  return (
113
115
  <Button
@@ -118,6 +120,42 @@ export function PillTrigger({
118
120
  aria-haspopup="menu"
119
121
  aria-expanded={open}
120
122
  onClick={onOpen}
123
+ // Clearing lives ON the pill: the filter and the way to remove it are one
124
+ // control, so removing one does not mean finding it again in a second
125
+ // list somewhere else on the page.
126
+ startIcon={
127
+ active && onClear ? (
128
+ <Box
129
+ component="span"
130
+ role="button"
131
+ tabIndex={0}
132
+ aria-label={`Limpar ${label}`}
133
+ data-testid={testId ? `${testId}-clear` : undefined}
134
+ onClick={(event: React.MouseEvent) => {
135
+ // The pill's own click opens the menu; clearing must not.
136
+ event.stopPropagation();
137
+ onClear();
138
+ }}
139
+ onKeyDown={(event: React.KeyboardEvent) => {
140
+ if (event.key !== 'Enter' && event.key !== ' ') return;
141
+ event.preventDefault();
142
+ event.stopPropagation();
143
+ onClear();
144
+ }}
145
+ sx={{
146
+ display: 'inline-flex',
147
+ alignItems: 'center',
148
+ justifyContent: 'center',
149
+ borderRadius: '50%',
150
+ cursor: 'pointer',
151
+ color: 'primary.main',
152
+ '&:hover': { bgcolor: 'primary.main', color: 'primary.contrastText' },
153
+ }}
154
+ >
155
+ <CloseIcon sx={{ fontSize: 14 }} />
156
+ </Box>
157
+ ) : undefined
158
+ }
121
159
  endIcon={<ChevronDownIcon sx={{ fontSize: 16 }} />}
122
160
  sx={{
123
161
  borderRadius: 999,