@economic/taco 0.0.1-alpha.1543 → 0.0.1-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Button/Button.d.ts +39 -1
- package/dist/components/Button/util.d.ts +2 -0
- package/dist/components/Checkbox/Checkbox.d.ts +1 -1
- package/dist/components/Dialog/Context.d.ts +1 -0
- package/dist/components/Dialog/Dialog.d.ts +14 -12
- package/dist/components/Hanger/Hanger.d.ts +4 -9
- package/dist/components/IconButton/IconButton.d.ts +38 -1
- package/dist/components/Navigation/Navigation.d.ts +4 -4
- package/dist/components/Popover/Popover.d.ts +5 -9
- package/dist/components/RadioGroup/RadioGroup.d.ts +2 -2
- package/dist/components/Select/Select.d.ts +4 -0
- package/dist/components/Select/useSelect.d.ts +1 -1
- package/dist/components/Table/Table.storyexample.d.ts +1 -1
- package/dist/components/Table/components/PaginatedTable.d.ts +2 -2
- package/dist/components/Table/components/Table.d.ts +2 -2
- package/dist/components/Table/components/WindowedTable.d.ts +2 -2
- package/dist/components/Table/types.d.ts +2 -2
- package/dist/components/Tabs/Tabs.d.ts +2 -2
- package/dist/components/Tooltip/Tooltip.d.ts +11 -1
- package/dist/components/Treeview/Treeview.d.ts +2 -2
- package/dist/esm/index.css +70 -93
- package/dist/esm/src/components/Button/Button.js +6 -9
- package/dist/esm/src/components/Button/Button.js.map +1 -1
- package/dist/esm/src/components/Button/util.js +42 -1
- package/dist/esm/src/components/Button/util.js.map +1 -1
- package/dist/esm/src/components/Calendar/Calendar.js +1 -1
- package/dist/esm/src/components/Checkbox/Checkbox.js +9 -1
- package/dist/esm/src/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/esm/src/components/Combobox/useCombobox.js +1 -1
- package/dist/esm/src/components/Datepicker/Datepicker.js +2 -2
- package/dist/esm/src/components/Dialog/Context.js +1 -0
- package/dist/esm/src/components/Dialog/Context.js.map +1 -1
- package/dist/esm/src/components/Dialog/Dialog.js +5 -4
- package/dist/esm/src/components/Dialog/Dialog.js.map +1 -1
- package/dist/esm/src/components/Dialog/components/Content.js +5 -5
- package/dist/esm/src/components/Dialog/components/Content.js.map +1 -1
- package/dist/esm/src/components/Dialog/components/Trigger.js +2 -1
- package/dist/esm/src/components/Dialog/components/Trigger.js.map +1 -1
- package/dist/esm/src/components/Hanger/Hanger.js +12 -9
- package/dist/esm/src/components/Hanger/Hanger.js.map +1 -1
- package/dist/esm/src/components/IconButton/IconButton.js +9 -11
- package/dist/esm/src/components/IconButton/IconButton.js.map +1 -1
- package/dist/esm/src/components/Listbox/ScrollableList.js +1 -1
- package/dist/esm/src/components/Navigation/Navigation.js +4 -4
- package/dist/esm/src/components/Navigation/Navigation.js.map +1 -1
- package/dist/esm/src/components/Pagination/PageNumbers.js +1 -1
- package/dist/esm/src/components/Pagination/Pagination.js +1 -1
- package/dist/esm/src/components/Popover/Popover.js +9 -6
- package/dist/esm/src/components/Popover/Popover.js.map +1 -1
- package/dist/esm/src/components/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/esm/src/components/SearchInput/SearchInput.js +7 -7
- package/dist/esm/src/components/Select/Select.js +2 -1
- package/dist/esm/src/components/Select/Select.js.map +1 -1
- package/dist/esm/src/components/Select/useSelect.js +12 -5
- package/dist/esm/src/components/Select/useSelect.js.map +1 -1
- package/dist/esm/src/components/Table/components/PaginatedTable.js.map +1 -1
- package/dist/esm/src/components/Table/components/Table.js.map +1 -1
- package/dist/esm/src/components/Table/components/WindowedTable.js.map +1 -1
- package/dist/esm/src/components/Table/hooks/plugins/useRowActions.js +11 -5
- package/dist/esm/src/components/Table/hooks/plugins/useRowActions.js.map +1 -1
- package/dist/esm/src/components/Table/hooks/plugins/useRowSelect.js +3 -3
- package/dist/esm/src/components/Table/hooks/plugins/useRowSelect.js.map +1 -1
- package/dist/esm/src/components/Table/util/renderColumn.js +4 -3
- package/dist/esm/src/components/Table/util/renderColumn.js.map +1 -1
- package/dist/esm/src/components/Table/util/renderRow.js +4 -3
- package/dist/esm/src/components/Table/util/renderRow.js.map +1 -1
- package/dist/esm/src/components/Tabs/Tabs.js.map +1 -1
- package/dist/esm/src/components/Toast/Toast.js +1 -1
- package/dist/esm/src/components/Tooltip/Tooltip.js +11 -10
- package/dist/esm/src/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/esm/src/components/Tour/Tour.js +2 -2
- package/dist/esm/src/components/Treeview/Treeview.js.map +1 -1
- package/dist/esm/src/index.js +7 -7
- package/dist/esm/src/primitives/Button.js +2 -12
- package/dist/esm/src/primitives/Button.js.map +1 -1
- package/dist/esm/src/utils/mergeRefs.js +14 -0
- package/dist/esm/src/utils/mergeRefs.js.map +1 -0
- package/dist/index.css +70 -93
- package/dist/primitives/Button.d.ts +0 -4
- package/dist/taco.cjs.development.js +1629 -1565
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/dist/utils/mergeRefs.d.ts +2 -0
- package/package.json +4 -3
- package/types.json +7309 -0
package/dist/esm/index.css
CHANGED
@@ -155,14 +155,6 @@
|
|
155
155
|
@apply max-h-full p-0;
|
156
156
|
}
|
157
157
|
|
158
|
-
[data-taco='button'] > [data-taco='icon'] {
|
159
|
-
@apply pointer-events-none -ml-2 mr-1 -mt-2 -mb-2 inline p-px;
|
160
|
-
}
|
161
|
-
|
162
|
-
[data-taco='button'] > span + [data-taco='icon'] {
|
163
|
-
@apply ml-1 -mr-2;
|
164
|
-
}
|
165
|
-
|
166
158
|
[data-taco='spinner'] svg circle {
|
167
159
|
@apply flex;
|
168
160
|
fill: transparent;
|
@@ -234,6 +226,51 @@
|
|
234
226
|
@apply -mt-px py-0 px-2;
|
235
227
|
}
|
236
228
|
|
229
|
+
[data-taco='hanger'] a {
|
230
|
+
@apply text-grey underline;
|
231
|
+
}
|
232
|
+
|
233
|
+
[data-taco='hanger'] > *:last-child {
|
234
|
+
@apply mb-0;
|
235
|
+
}
|
236
|
+
|
237
|
+
.yt-dialog__drag::before,
|
238
|
+
.yt-dialog__drag::after {
|
239
|
+
@apply absolute bg-grey-dark rounded;
|
240
|
+
content: '';
|
241
|
+
left: theme('spacing.1');
|
242
|
+
height: 2px;
|
243
|
+
width: calc(100% - (2 * theme('spacing.1')));
|
244
|
+
}
|
245
|
+
|
246
|
+
.yt-dialog__drag::before {
|
247
|
+
top: 3px;
|
248
|
+
}
|
249
|
+
|
250
|
+
.yt-dialog__drag::after {
|
251
|
+
bottom: 3px;
|
252
|
+
}
|
253
|
+
|
254
|
+
.yt-dialog *:last-child {
|
255
|
+
@apply mb-0;
|
256
|
+
}
|
257
|
+
|
258
|
+
[data-taco='group'] > [data-taco='badge'] + [data-taco='badge'] {
|
259
|
+
@apply ml-1;
|
260
|
+
}
|
261
|
+
|
262
|
+
[data-taco='group'] > *:not(:first-child):not([data-taco='hanger']) {
|
263
|
+
@apply ml-2;
|
264
|
+
}
|
265
|
+
|
266
|
+
[data-taco='button'] > [data-taco='icon'] {
|
267
|
+
@apply pointer-events-none -ml-2 mr-1 -mt-2 -mb-2 inline p-px;
|
268
|
+
}
|
269
|
+
|
270
|
+
[data-taco='button'] > span + [data-taco='icon'] {
|
271
|
+
@apply ml-1 -mr-2;
|
272
|
+
}
|
273
|
+
|
237
274
|
[data-taco='calendar'] .DayPicker-wrapper {
|
238
275
|
@apply relative select-none flex-row;
|
239
276
|
}
|
@@ -395,35 +432,6 @@
|
|
395
432
|
@apply border-blue;
|
396
433
|
}
|
397
434
|
|
398
|
-
.yt-dialog__drag::before,
|
399
|
-
.yt-dialog__drag::after {
|
400
|
-
@apply absolute bg-grey-dark rounded;
|
401
|
-
content: '';
|
402
|
-
left: theme('spacing.1');
|
403
|
-
height: 2px;
|
404
|
-
width: calc(100% - (2 * theme('spacing.1')));
|
405
|
-
}
|
406
|
-
|
407
|
-
.yt-dialog__drag::before {
|
408
|
-
top: 3px;
|
409
|
-
}
|
410
|
-
|
411
|
-
.yt-dialog__drag::after {
|
412
|
-
bottom: 3px;
|
413
|
-
}
|
414
|
-
|
415
|
-
.yt-dialog *:last-child {
|
416
|
-
@apply mb-0;
|
417
|
-
}
|
418
|
-
|
419
|
-
[data-taco='group'] > [data-taco='badge'] + [data-taco='badge'] {
|
420
|
-
@apply ml-1;
|
421
|
-
}
|
422
|
-
|
423
|
-
[data-taco='group'] > *:not(:first-child):not([data-taco='hanger']) {
|
424
|
-
@apply ml-2;
|
425
|
-
}
|
426
|
-
|
427
435
|
.yt-form > [data-taco='button'] {
|
428
436
|
@apply mr-3;
|
429
437
|
}
|
@@ -440,14 +448,6 @@
|
|
440
448
|
@apply mt-6;
|
441
449
|
}
|
442
450
|
|
443
|
-
[data-taco='hanger'] a {
|
444
|
-
@apply text-grey underline;
|
445
|
-
}
|
446
|
-
|
447
|
-
[data-taco='hanger'] > *:last-child {
|
448
|
-
@apply mb-0;
|
449
|
-
}
|
450
|
-
|
451
451
|
/* label inside label is invalid html, but the client is littered with it */
|
452
452
|
[data-taco='label'] [data-taco='label'] {
|
453
453
|
min-height: 0;
|
@@ -517,7 +517,7 @@
|
|
517
517
|
}
|
518
518
|
|
519
519
|
[data-taco='select'] > button.yt-input .yt-icon {
|
520
|
-
@apply pointer-events-none
|
520
|
+
@apply pointer-events-none;
|
521
521
|
}
|
522
522
|
|
523
523
|
[data-taco='select'] > button.yt-input[disabled] .yt-icon {
|
@@ -528,12 +528,6 @@
|
|
528
528
|
@apply cursor-not-allowed;
|
529
529
|
}
|
530
530
|
|
531
|
-
[data-taco='select']:hover > button.yt-input .yt-icon,
|
532
|
-
[data-taco='select'] > button.yt-input:hover .yt-icon,
|
533
|
-
[data-taco='select'] > button.yt-input .yt-icon:hover {
|
534
|
-
@apply text-grey-darkest;
|
535
|
-
}
|
536
|
-
|
537
531
|
[data-taco='select'] > button.yt-input[aria-expanded='true'],
|
538
532
|
[data-taco='select'] > button.yt-input[aria-expanded='true']:hover {
|
539
533
|
@apply border-blue;
|
@@ -584,81 +578,73 @@
|
|
584
578
|
}
|
585
579
|
|
586
580
|
.yt-table:focus {
|
587
|
-
@apply rounded-sm
|
581
|
+
@apply yt-focus rounded-sm;
|
588
582
|
}
|
589
583
|
|
590
584
|
/* rows */
|
591
585
|
.yt-table__row {
|
592
|
-
@apply border-
|
586
|
+
@apply border-grey-light flex border-b;
|
593
587
|
min-height: 2.5rem;
|
594
588
|
}
|
595
589
|
|
596
590
|
/* cells */
|
597
591
|
.yt-table__cell {
|
598
|
-
@apply flex-1 p-2
|
599
|
-
}
|
600
|
-
|
601
|
-
.yt-table__cell.yt-table__cell__actions {
|
602
|
-
@apply flex justify-end px-1 overflow-visible;
|
592
|
+
@apply flex-1 truncate p-2 text-center align-middle;
|
603
593
|
}
|
604
594
|
|
605
|
-
.yt-table__cell >
|
606
|
-
.yt-table__cell
|
607
|
-
@apply -mt-1 -mb-1;
|
608
|
-
}
|
609
|
-
|
610
|
-
.yt-table__cell.yt-table__cell__actions .yt-group > *:not(:first-child):not(.yt-hanger):not(.yt-menu) {
|
611
|
-
@apply ml-0;
|
595
|
+
.yt-table__cell > [data-taco='button'],
|
596
|
+
.yt-table__cell > [data-taco='icon-button'] {
|
597
|
+
@apply -mt-1 -mb-1 flex;
|
612
598
|
}
|
613
599
|
|
614
600
|
.yt-table__cell.yt-table__cell--draggable {
|
615
601
|
@apply flex-col px-0;
|
616
602
|
}
|
617
603
|
|
618
|
-
.yt-table__cell.yt-table__cell--draggable
|
619
|
-
@apply
|
604
|
+
.yt-table__cell.yt-table__cell--draggable [data-taco='icon'] {
|
605
|
+
@apply text-grey-darkest invisible cursor-grab;
|
620
606
|
width: 20px;
|
621
607
|
}
|
622
608
|
|
623
|
-
.yt-table__row.yt-table__row--dragging .yt-table__cell.yt-table__cell--draggable
|
609
|
+
.yt-table__row.yt-table__row--dragging .yt-table__cell.yt-table__cell--draggable [data-taco='icon'] {
|
624
610
|
@apply text-white;
|
625
611
|
}
|
626
612
|
|
627
|
-
.yt-table__cell.yt-table__cell--draggable
|
613
|
+
.yt-table__cell.yt-table__cell--draggable [data-taco='icon']:active {
|
628
614
|
@apply cursor-grabbing;
|
629
615
|
}
|
630
616
|
|
631
|
-
.yt-table__row:hover .yt-table__cell.yt-table__cell--draggable
|
617
|
+
.yt-table__row:hover .yt-table__cell.yt-table__cell--draggable [data-taco='icon'] {
|
632
618
|
@apply visible;
|
633
619
|
}
|
634
620
|
|
635
621
|
/* head */
|
636
622
|
.yt-table__head .yt-table__row {
|
637
|
-
@apply border-t-0 border-b-2 font-bold
|
623
|
+
@apply h-auto w-full select-none border-t-0 border-b-2 font-bold;
|
638
624
|
}
|
639
625
|
|
640
626
|
.yt-table__head .yt-table__head__group {
|
641
|
-
@apply flex flex-
|
627
|
+
@apply flex flex-1 flex-wrap;
|
642
628
|
}
|
643
629
|
|
644
630
|
.yt-table__head .yt-table__head__group .yt-table__cell.yt-table__cell__group {
|
645
|
-
@apply border-
|
631
|
+
@apply border-grey-light border-b;
|
646
632
|
flex-basis: 100%;
|
647
633
|
}
|
648
634
|
|
649
635
|
.yt-table__head .yt-table__head__group + .yt-table__head__group {
|
650
|
-
@apply border-
|
636
|
+
@apply border-grey-light border-l;
|
651
637
|
}
|
652
638
|
|
653
639
|
.yt-table__head .yt-table__cell {
|
654
|
-
@apply
|
640
|
+
@apply text-grey-darkest flex justify-center;
|
655
641
|
}
|
656
642
|
|
657
643
|
.yt-table__head .yt-table__cell > span {
|
658
644
|
@apply truncate;
|
659
645
|
}
|
660
646
|
|
661
|
-
.yt-table__head .yt-table__cell >
|
647
|
+
.yt-table__head .yt-table__cell > [data-taco='icon'] {
|
662
648
|
@apply flex-shrink-0;
|
663
649
|
}
|
664
650
|
|
@@ -667,7 +653,7 @@
|
|
667
653
|
}
|
668
654
|
|
669
655
|
.yt-table__head .yt-table__cell.yt-table__cell__group + .yt-table__cell__group {
|
670
|
-
@apply border-
|
656
|
+
@apply border-grey-light border-l-2;
|
671
657
|
}
|
672
658
|
|
673
659
|
.yt-table__head .yt-table__cell:not(.yt-table__cell--disable-sort) {
|
@@ -723,35 +709,26 @@
|
|
723
709
|
overflow-wrap: normal;
|
724
710
|
}
|
725
711
|
|
726
|
-
.yt-table__cell
|
727
|
-
@apply
|
712
|
+
.yt-table__cell [data-taco='label'] {
|
713
|
+
@apply -my-2 pb-0 text-transparent;
|
728
714
|
min-height: theme('spacing.10');
|
729
715
|
}
|
730
716
|
|
731
|
-
.yt-table__cell
|
717
|
+
.yt-table__cell [data-taco='label'] > *:not([data-taco='label']__message) {
|
732
718
|
@apply mt-1;
|
733
719
|
}
|
734
720
|
|
735
|
-
.yt-table__body .yt-table__row.yt-table__row--editing .yt-table__cell
|
721
|
+
.yt-table__body .yt-table__row.yt-table__row--editing .yt-table__cell [data-taco='label'] > *:not([data-taco='label']__message) {
|
736
722
|
@apply -mt-5;
|
737
723
|
}
|
738
724
|
|
739
|
-
.yt-table__cell
|
725
|
+
.yt-table__cell [data-taco='label'] > [data-taco='label']__message {
|
740
726
|
@apply mb-1;
|
741
727
|
}
|
742
728
|
|
743
729
|
/* drag */
|
744
730
|
#yt-table__drag__placeholder {
|
745
|
-
@apply bg-blue
|
746
|
-
}
|
747
|
-
|
748
|
-
/* cell alignment */
|
749
|
-
.yt-table__cell.yt-table__cell--align-left {
|
750
|
-
@apply justify-start text-left;
|
751
|
-
}
|
752
|
-
|
753
|
-
.yt-table__cell.yt-table__cell--align-right {
|
754
|
-
@apply justify-end text-right;
|
731
|
+
@apply bg-blue flex w-3/12 rounded p-4 font-bold text-white;
|
755
732
|
}
|
756
733
|
|
757
734
|
.yt-tabs .yt-tab__list[aria-orientation='vertical'] {
|
@@ -1,8 +1,7 @@
|
|
1
|
-
import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
2
|
-
import { forwardRef
|
1
|
+
import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose, extends as _extends } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
2
|
+
import { forwardRef } from 'react';
|
3
3
|
import cn from 'classnames';
|
4
|
-
import {
|
5
|
-
import { getButtonClasses, getAppearanceClasses } from './util.js';
|
4
|
+
import { getButtonClasses, getAppearanceClasses, createButton } from './util.js';
|
6
5
|
|
7
6
|
var _excluded = ["appearance", "fluid"];
|
8
7
|
var Button = /*#__PURE__*/forwardRef(function Button(props, ref) {
|
@@ -15,11 +14,9 @@ var Button = /*#__PURE__*/forwardRef(function Button(props, ref) {
|
|
15
14
|
'focus:yt-focus active:focus:yt-focus': !props.disabled,
|
16
15
|
'w-full': fluid
|
17
16
|
}, props.className);
|
18
|
-
return
|
19
|
-
|
20
|
-
|
21
|
-
ref: ref
|
22
|
-
}));
|
17
|
+
return createButton(_extends({}, otherProps, {
|
18
|
+
'data-taco': 'button'
|
19
|
+
}), className, ref);
|
23
20
|
});
|
24
21
|
|
25
22
|
export { Button };
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../../../../../src/components/Button/Button.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport { Appearance } from '../../types';\nimport * as ButtonPrimitive from '../../primitives/Button';\nimport './
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../../../../src/components/Button/Button.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport { Appearance } from '../../types';\nimport * as ButtonPrimitive from '../../primitives/Button';\nimport { getAppearanceClasses, getButtonClasses, createButton } from './util';\nimport { HangerProps } from '../Hanger/Hanger';\nimport { DialogProps } from '../Dialog/Dialog';\nimport { PopoverProps } from '../Popover/Popover';\nimport './Button.css';\n\nexport type ButtonProps = ButtonPrimitive.ButtonProps & {\n /** Appearance will change the style of the button */\n appearance?: Appearance;\n /**\n * Dialog component associated with the button, clicking the button will open the dialog.\n * *Note* that `onClick` event on button won't be handled, as in this case, the purpose of\n * the button should be only to open the associated dialog when clicked.\n */\n dialog?: React.ReactElement<DialogProps>;\n /** If fluid, button expands to the width of it's container */\n fluid?: boolean;\n /** Hanger component associated with the button. */\n hanger?: React.ReactElement<HangerProps>;\n /**\n * Popover component associated with the button, clicking the button will open the popover.\n * *Note* that `onClick` event on button won't be handled, as in this case, the purpose of\n * the button should be only to open the associated popover when clicked.\n */\n popover?: React.ReactElement<PopoverProps>;\n /** A tooltip to show when hovering over the button */\n tooltip?: string;\n};\n\nexport const Button = React.forwardRef(function Button(\n props: ButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>\n) {\n const { appearance, fluid, ...otherProps } = props;\n const className = cn(\n getButtonClasses(),\n getAppearanceClasses(appearance),\n 'rounded px-3',\n {\n 'cursor-not-allowed opacity-50': props.disabled,\n 'focus:yt-focus active:focus:yt-focus': !props.disabled,\n 'w-full': fluid,\n },\n props.className\n );\n\n return createButton({ ...otherProps, 'data-taco': 'button' }, className, ref);\n});\n"],"names":["Button","React","props","ref","appearance","fluid","otherProps","className","cn","getButtonClasses","getAppearanceClasses","disabled","createButton"],"mappings":";;;;;;IAiCaA,MAAM,gBAAGC,UAAA,CAAiB,SAASD,MAAT,CACnCE,KADmC,EAEnCC,GAFmC;AAInC,MAAQC,UAAR,GAA6CF,KAA7C,CAAQE,UAAR;AAAA,MAAoBC,KAApB,GAA6CH,KAA7C,CAAoBG,KAApB;AAAA,MAA8BC,UAA9B,iCAA6CJ,KAA7C;;AACA,MAAMK,SAAS,GAAGC,EAAE,CAChBC,gBAAgB,EADA,EAEhBC,oBAAoB,CAACN,UAAD,CAFJ,EAGhB,cAHgB,EAIhB;AACI,qCAAiCF,KAAK,CAACS,QAD3C;AAEI,4CAAwC,CAACT,KAAK,CAACS,QAFnD;AAGI,cAAUN;AAHd,GAJgB,EAShBH,KAAK,CAACK,SATU,CAApB;AAYA,SAAOK,YAAY,cAAMN,UAAN;AAAkB,iBAAa;AAA/B,MAA2CC,SAA3C,EAAsDJ,GAAtD,CAAnB;AACH,CAlBqB;;;;"}
|
@@ -1,3 +1,12 @@
|
|
1
|
+
import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
2
|
+
import React__default from 'react';
|
3
|
+
import { Button } from '../../primitives/Button.js';
|
4
|
+
import { Tooltip } from '../Tooltip/Tooltip.js';
|
5
|
+
import { Hanger } from '../Hanger/Hanger.js';
|
6
|
+
import { Dialog } from '../Dialog/Dialog.js';
|
7
|
+
import { Popover } from '../Popover/Popover.js';
|
8
|
+
|
9
|
+
var _excluded = ["dialog", "hanger", "popover", "tooltip"];
|
1
10
|
var getButtonClasses = function getButtonClasses() {
|
2
11
|
return 'min-h-[theme(spacing.8)] min-w-[theme(spacing.8)] leading-6 inline-flex items-center justify-center transition-all delay-100 ease-in border';
|
3
12
|
};
|
@@ -29,6 +38,38 @@ var getAppearanceClasses = function getAppearanceClasses(value, icon) {
|
|
29
38
|
return "yt-grey-solid border-grey\n focus:bg-grey focus:yt-focus\n active:bg-grey-dark active:text-black\n hover:bg-grey-light hover:text-grey-darkest\n hover:focus:bg-grey-light hover:focus:text-grey-darkest\n disabled:hover:yt-grey-solid";
|
30
39
|
}
|
31
40
|
};
|
41
|
+
var createButton = function createButton(props, className, ref) {
|
42
|
+
var dialog = props.dialog,
|
43
|
+
hanger = props.hanger,
|
44
|
+
popover = props.popover,
|
45
|
+
tooltip = props.tooltip,
|
46
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
47
|
+
|
48
|
+
var button = React__default.createElement(Button, Object.assign({}, otherProps, {
|
49
|
+
className: className,
|
50
|
+
ref: ref
|
51
|
+
}));
|
52
|
+
|
53
|
+
if (hanger) {
|
54
|
+
button = React__default.createElement(Hanger, Object.assign({}, hanger.props), React__default.createElement(Hanger.Anchor, null, button), hanger.props.children);
|
55
|
+
}
|
56
|
+
|
57
|
+
if (dialog) {
|
58
|
+
button = React__default.createElement(Dialog, Object.assign({}, dialog.props), React__default.createElement(Dialog.Trigger, null, button), dialog.props.children);
|
59
|
+
}
|
60
|
+
|
61
|
+
if (popover) {
|
62
|
+
button = React__default.createElement(Popover, Object.assign({}, popover.props), React__default.createElement(Popover.Trigger, null, button), popover.props.children);
|
63
|
+
}
|
64
|
+
|
65
|
+
if (tooltip) {
|
66
|
+
button = React__default.createElement(Tooltip, {
|
67
|
+
title: tooltip
|
68
|
+
}, button);
|
69
|
+
}
|
70
|
+
|
71
|
+
return button;
|
72
|
+
};
|
32
73
|
|
33
|
-
export { getAppearanceClasses, getButtonClasses };
|
74
|
+
export { createButton, getAppearanceClasses, getButtonClasses };
|
34
75
|
//# sourceMappingURL=util.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"util.js","sources":["../../../../../src/components/Button/util.
|
1
|
+
{"version":3,"file":"util.js","sources":["../../../../../src/components/Button/util.tsx"],"sourcesContent":["import React from 'react';\nimport { Appearance } from '../../types';\nimport * as ButtonPrimitive from '../../primitives/Button';\nimport { Tooltip } from '../Tooltip/Tooltip';\nimport { Hanger } from '../Hanger/Hanger';\nimport { Dialog } from '../Dialog/Dialog';\nimport { Popover } from '../Popover/Popover';\n\nexport const getButtonClasses = () => {\n return 'min-h-[theme(spacing.8)] min-w-[theme(spacing.8)] leading-6 inline-flex items-center justify-center transition-all delay-100 ease-in border';\n};\n\nexport const getAppearanceClasses = (value: Appearance | undefined, icon = false): string => {\n switch (value) {\n case 'primary':\n return `yt-blue-solid border-blue\n focus:bg-blue focus:text-white focus:yt-focus\n active:bg-blue-dark active:text-white \n hover:bg-blue-light hover:border-blue-light hover:text-white\n hover:focus:bg-blue-light hover:focus:border-blue-light hover:focus:text-white\n disabled:hover:yt-blue-solid`;\n\n case 'danger':\n return `yt-red-solid border-red\n focus:bg-red focus:text-white focus:yt-focus-red\n active:bg-red-dark active:text-white \n hover:bg-red-light hover:text-white\n hover:focus:bg-red-light hover:focus:text-white\n disabled:hover:yt-red-solid`;\n\n case 'ghost':\n return `yt-blue-inverted\n focus:bg-transparent focus:text-blue focus:yt-focus\n active:bg-blue-lightest active:border-blue active:text-blue-dark \n hover:bg-blue-lightest hover:border-blue-light hover:text-blue-light\n hover:focus:bg-blue-lightest hover:focus:border-blue-light hover:focus:text-blue-light\n disabled:hover:yt-blue-inverted`;\n\n case 'discrete': {\n if (icon) {\n return `bg-transparent text-black border-transparent\n focus:text-black focus:yt-focus\n active:text-black\n hover:text-grey-darkest\n hover:focus:text-grey-darkest\n disabled:hover:yt-transparent`;\n }\n\n return `yt-transparent border-transparent\n focus:text-blue focus:yt-focus\n active:text-blue-dark\n hover:text-blue-light\n hover:focus:text-blue-light\n disabled:hover:yt-transparent`;\n }\n\n default:\n return `yt-grey-solid border-grey\n focus:bg-grey focus:yt-focus\n active:bg-grey-dark active:text-black\n hover:bg-grey-light hover:text-grey-darkest\n hover:focus:bg-grey-light hover:focus:text-grey-darkest\n disabled:hover:yt-grey-solid`;\n }\n};\n\nexport const createButton = (\n props: any,\n className: string,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>\n): JSX.Element => {\n const { dialog, hanger, popover, tooltip, ...otherProps } = props;\n\n let button = <ButtonPrimitive.Button {...otherProps} className={className} ref={ref} />;\n\n if (hanger) {\n button = (\n <Hanger {...hanger.props}>\n <Hanger.Anchor>{button}</Hanger.Anchor>\n {hanger.props.children}\n </Hanger>\n );\n }\n\n if (dialog) {\n button = (\n <Dialog {...dialog.props}>\n <Dialog.Trigger>{button}</Dialog.Trigger>\n {dialog.props.children}\n </Dialog>\n );\n }\n\n if (popover) {\n button = (\n <Popover {...popover.props}>\n <Popover.Trigger>{button}</Popover.Trigger>\n {popover.props.children}\n </Popover>\n );\n }\n\n if (tooltip) {\n button = <Tooltip title={tooltip}>{button}</Tooltip>;\n }\n\n return button;\n};\n"],"names":["getButtonClasses","getAppearanceClasses","value","icon","createButton","props","className","ref","dialog","hanger","popover","tooltip","otherProps","button","React","ButtonPrimitive","Hanger","Anchor","children","Dialog","Trigger","Popover","Tooltip","title"],"mappings":";;;;;;;;;IAQaA,gBAAgB,GAAG,SAAnBA,gBAAmB;AAC5B,SAAO,6IAAP;AACH;IAEYC,oBAAoB,GAAG,SAAvBA,oBAAuB,CAACC,KAAD,EAAgCC,IAAhC;MAAgCA;AAAAA,IAAAA,OAAO;;;AACvE,UAAQD,KAAR;AACI,SAAK,SAAL;AACI;;AAOJ,SAAK,QAAL;AACI;;AAOJ,SAAK,OAAL;AACI;;AAOJ,SAAK,UAAL;AAAiB;AACb,YAAIC,IAAJ,EAAU;AACN;AAMH;;AAED;AAMH;;AAED;AACI;AA5CR;AAmDH;IAEYC,YAAY,GAAG,SAAfA,YAAe,CACxBC,KADwB,EAExBC,SAFwB,EAGxBC,GAHwB;AAKxB,MAAQC,MAAR,GAA4DH,KAA5D,CAAQG,MAAR;AAAA,MAAgBC,MAAhB,GAA4DJ,KAA5D,CAAgBI,MAAhB;AAAA,MAAwBC,OAAxB,GAA4DL,KAA5D,CAAwBK,OAAxB;AAAA,MAAiCC,OAAjC,GAA4DN,KAA5D,CAAiCM,OAAjC;AAAA,MAA6CC,UAA7C,iCAA4DP,KAA5D;;AAEA,MAAIQ,MAAM,GAAGC,4BAAA,CAACC,MAAD,oBAA4BH;AAAYN,IAAAA,SAAS,EAAEA;AAAWC,IAAAA,GAAG,EAAEA;IAAnE,CAAb;;AAEA,MAAIE,MAAJ,EAAY;AACRI,IAAAA,MAAM,GACFC,4BAAA,CAACE,MAAD,oBAAYP,MAAM,CAACJ,MAAnB,EACIS,4BAAA,CAACE,MAAM,CAACC,MAAR,MAAA,EAAgBJ,MAAhB,CADJ,EAEKJ,MAAM,CAACJ,KAAP,CAAaa,QAFlB,CADJ;AAMH;;AAED,MAAIV,MAAJ,EAAY;AACRK,IAAAA,MAAM,GACFC,4BAAA,CAACK,MAAD,oBAAYX,MAAM,CAACH,MAAnB,EACIS,4BAAA,CAACK,MAAM,CAACC,OAAR,MAAA,EAAiBP,MAAjB,CADJ,EAEKL,MAAM,CAACH,KAAP,CAAaa,QAFlB,CADJ;AAMH;;AAED,MAAIR,OAAJ,EAAa;AACTG,IAAAA,MAAM,GACFC,4BAAA,CAACO,OAAD,oBAAaX,OAAO,CAACL,MAArB,EACIS,4BAAA,CAACO,OAAO,CAACD,OAAT,MAAA,EAAkBP,MAAlB,CADJ,EAEKH,OAAO,CAACL,KAAR,CAAca,QAFnB,CADJ;AAMH;;AAED,MAAIP,OAAJ,EAAa;AACTE,IAAAA,MAAM,GAAGC,4BAAA,CAACQ,OAAD;AAASC,MAAAA,KAAK,EAAEZ;KAAhB,EAA0BE,MAA1B,CAAT;AACH;;AAED,SAAOA,MAAP;AACH;;;;"}
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
2
2
|
import { forwardRef, useState, useEffect, createElement, memo } from 'react';
|
3
3
|
import cn from 'classnames';
|
4
|
+
import { useLocalization } from '../Provider/Provider.js';
|
4
5
|
import { IconButton } from '../IconButton/IconButton.js';
|
5
6
|
import ReactDayPicker from 'react-day-picker';
|
6
|
-
import { useLocalization } from '../Provider/Provider.js';
|
7
7
|
|
8
8
|
var _excluded = ["onChange", "value"];
|
9
9
|
|
@@ -21,11 +21,19 @@ var Checkbox = /*#__PURE__*/forwardRef(function Checkbox(props, ref) {
|
|
21
21
|
'bg-[rgba(255,255,0,0.2)] disabled:bg-[rgba(255,255,0,0.075)]': highlighted,
|
22
22
|
'border-red text-red focus:border-red focus:yt-focus-red': invalid && !props.disabled
|
23
23
|
}, props.className);
|
24
|
+
var handleChange;
|
25
|
+
|
26
|
+
if (onChange) {
|
27
|
+
handleChange = function handleChange(checked) {
|
28
|
+
return onChange(checked === 'indeterminate' ? false : checked);
|
29
|
+
};
|
30
|
+
}
|
31
|
+
|
24
32
|
var element = createElement(Root, Object.assign({}, otherProps, {
|
25
33
|
"data-taco": "checkbox",
|
26
34
|
checked: indeterminate ? 'indeterminate' : checked,
|
27
35
|
className: className,
|
28
|
-
onCheckedChange:
|
36
|
+
onCheckedChange: handleChange,
|
29
37
|
ref: ref
|
30
38
|
}), createElement(Indicator, {
|
31
39
|
className: "flex h-full w-full"
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Checkbox.js","sources":["../../../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as CheckboxPrimitive from '@radix-ui/react-checkbox';\nimport { Icon } from '../Icon/Icon';\n\ntype CheckboxBaseProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'onChange'> & {\n /* Increases visual prominenance of the checkbox */\n highlighted?: boolean;\n /**\n * Indeterminate state should only be used with sub-checkboxes. The indeterminate state is shown if not all\n * sub-checkboxes are selected. This only affects the style, changing the icon in the checkbox.\n */\n indeterminate?: boolean;\n /* Whether the checkbox is in an invalid state */\n invalid?: boolean;\n /** Label for the checkbox */\n label?: React.ReactNode;\n /* Whether user input is required */\n required?: boolean;\n};\n\ninterface UncontrolledCheckboxProps extends CheckboxBaseProps {\n checked?: never;\n onChange?: never;\n /* The default checked state (uncontrolled) */\n defaultChecked?: boolean;\n}\n\ninterface ControlledCheckboxProps extends CheckboxBaseProps {\n defaultChecked?: never;\n /* The current checked state (controlled) */\n checked: boolean;\n /* Handler called when the checked state changes */\n onChange: (checked: boolean
|
1
|
+
{"version":3,"file":"Checkbox.js","sources":["../../../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as CheckboxPrimitive from '@radix-ui/react-checkbox';\nimport { Icon } from '../Icon/Icon';\n\ntype CheckedState = boolean | 'indeterminate';\n\ntype CheckboxBaseProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'onChange'> & {\n /* Increases visual prominenance of the checkbox */\n highlighted?: boolean;\n /**\n * Indeterminate state should only be used with sub-checkboxes. The indeterminate state is shown if not all\n * sub-checkboxes are selected. This only affects the style, changing the icon in the checkbox.\n */\n indeterminate?: boolean;\n /* Whether the checkbox is in an invalid state */\n invalid?: boolean;\n /** Label for the checkbox */\n label?: React.ReactNode;\n /* Whether user input is required */\n required?: boolean;\n};\n\ninterface UncontrolledCheckboxProps extends CheckboxBaseProps {\n checked?: never;\n onChange?: never;\n /* The default checked state (uncontrolled) */\n defaultChecked?: boolean;\n}\n\ninterface ControlledCheckboxProps extends CheckboxBaseProps {\n defaultChecked?: never;\n /* The current checked state (controlled) */\n checked: boolean;\n /* Handler called when the checked state changes */\n onChange: (checked: boolean) => void;\n}\n\nexport type CheckboxProps = UncontrolledCheckboxProps | ControlledCheckboxProps;\n\nexport const Checkbox = React.forwardRef(function Checkbox(props: CheckboxProps, ref: React.Ref<HTMLButtonElement>) {\n const { checked, highlighted, indeterminate, invalid, label, onChange, ...otherProps } = props;\n\n const className = cn(\n 'h-5 w-5 border rounded text-sm',\n {\n 'mr-2': !!label,\n 'border-grey-dark text-blue focus:border-blue focus:yt-focus': !props.disabled && !invalid,\n 'border-grey text-blue-light cursor-not-allowed': props.disabled,\n 'bg-[rgba(255,255,0,0.2)] disabled:bg-[rgba(255,255,0,0.075)]': highlighted,\n 'border-red text-red focus:border-red focus:yt-focus-red': invalid && !props.disabled,\n },\n props.className\n );\n\n let handleChange: ((checked: CheckedState) => void) | undefined;\n\n if (onChange) {\n handleChange = (checked: CheckedState) => onChange(checked === 'indeterminate' ? false : checked);\n }\n\n const element = (\n <CheckboxPrimitive.Root\n {...otherProps}\n data-taco=\"checkbox\"\n checked={indeterminate ? 'indeterminate' : checked}\n className={className}\n onCheckedChange={handleChange}\n ref={ref}\n >\n <CheckboxPrimitive.Indicator className=\"flex h-full w-full\">\n <Icon name={indeterminate ? 'line' : 'tick'} className=\"!h-full !w-full\" />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n );\n\n if (label) {\n const labelClassName = cn('flex items-center cursor-pointer', {\n 'cursor-not-allowed text-grey-dark': props.disabled,\n });\n\n return (\n <label className={labelClassName}>\n {element}\n {label}\n </label>\n );\n }\n\n return element;\n});\n"],"names":["Checkbox","React","props","ref","checked","highlighted","indeterminate","invalid","label","onChange","otherProps","className","cn","disabled","handleChange","element","CheckboxPrimitive","onCheckedChange","Icon","name","labelClassName"],"mappings":";;;;;;;IAwCaA,QAAQ,gBAAGC,UAAA,CAAiB,SAASD,QAAT,CAAkBE,KAAlB,EAAwCC,GAAxC;AACrC,MAAQC,OAAR,GAAyFF,KAAzF,CAAQE,OAAR;AAAA,MAAiBC,WAAjB,GAAyFH,KAAzF,CAAiBG,WAAjB;AAAA,MAA8BC,aAA9B,GAAyFJ,KAAzF,CAA8BI,aAA9B;AAAA,MAA6CC,OAA7C,GAAyFL,KAAzF,CAA6CK,OAA7C;AAAA,MAAsDC,KAAtD,GAAyFN,KAAzF,CAAsDM,KAAtD;AAAA,MAA6DC,QAA7D,GAAyFP,KAAzF,CAA6DO,QAA7D;AAAA,MAA0EC,UAA1E,iCAAyFR,KAAzF;;AAEA,MAAMS,SAAS,GAAGC,EAAE,CAChB,gCADgB,EAEhB;AACI,YAAQ,CAAC,CAACJ,KADd;AAEI,mEAA+D,CAACN,KAAK,CAACW,QAAP,IAAmB,CAACN,OAFvF;AAGI,sDAAkDL,KAAK,CAACW,QAH5D;AAII,oEAAgER,WAJpE;AAKI,+DAA2DE,OAAO,IAAI,CAACL,KAAK,CAACW;AALjF,GAFgB,EAShBX,KAAK,CAACS,SATU,CAApB;AAYA,MAAIG,YAAJ;;AAEA,MAAIL,QAAJ,EAAc;AACVK,IAAAA,YAAY,GAAG,sBAACV,OAAD;AAAA,aAA2BK,QAAQ,CAACL,OAAO,KAAK,eAAZ,GAA8B,KAA9B,GAAsCA,OAAvC,CAAnC;AAAA,KAAf;AACH;;AAED,MAAMW,OAAO,GACTd,aAAA,CAACe,IAAD,oBACQN;iBACM;AACVN,IAAAA,OAAO,EAAEE,aAAa,GAAG,eAAH,GAAqBF;AAC3CO,IAAAA,SAAS,EAAEA;AACXM,IAAAA,eAAe,EAAEH;AACjBX,IAAAA,GAAG,EAAEA;IANT,EAQIF,aAAA,CAACe,SAAD;AAA6BL,IAAAA,SAAS,EAAC;GAAvC,EACIV,aAAA,CAACiB,IAAD;AAAMC,IAAAA,IAAI,EAAEb,aAAa,GAAG,MAAH,GAAY;AAAQK,IAAAA,SAAS,EAAC;GAAvD,CADJ,CARJ,CADJ;;AAeA,MAAIH,KAAJ,EAAW;AACP,QAAMY,cAAc,GAAGR,EAAE,CAAC,kCAAD,EAAqC;AAC1D,2CAAqCV,KAAK,CAACW;AADe,KAArC,CAAzB;AAIA,WACIZ,aAAA,QAAA;AAAOU,MAAAA,SAAS,EAAES;KAAlB,EACKL,OADL,EAEKP,KAFL,CADJ;AAMH;;AAED,SAAOO,OAAP;AACH,CAlDuB;;;;"}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { extends as _extends, objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
2
2
|
import { useRef, useMemo, useState, useEffect } from 'react';
|
3
3
|
import { v4 } from 'uuid';
|
4
|
-
import { usePopoverState } from 'reakit/Popover';
|
5
4
|
import { useProxiedRef } from '../../utils/hooks/useProxiedRef.js';
|
5
|
+
import { usePopoverState } from 'reakit/Popover';
|
6
6
|
import keycode from 'keycode';
|
7
7
|
import { getId } from '../Listbox/ScrollableList.js';
|
8
8
|
import { createCustomKeyboardEvent } from '../../utils/input.js';
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
2
2
|
import { forwardRef, createElement } from 'react';
|
3
3
|
import cn from 'classnames';
|
4
|
-
import { IconButton } from '../IconButton/IconButton.js';
|
5
4
|
import { useLocalization } from '../Provider/Provider.js';
|
5
|
+
import { Popover } from '../Popover/Popover.js';
|
6
|
+
import { IconButton } from '../IconButton/IconButton.js';
|
6
7
|
import { Calendar } from '../Calendar/Calendar.js';
|
7
8
|
import { Input } from '../Input/Input.js';
|
8
9
|
import { useDatepicker } from './useDatepicker.js';
|
9
|
-
import { Popover } from '../Popover/Popover.js';
|
10
10
|
|
11
11
|
var _excluded = ["className", "onReset", "style", "shortcuts", "shortcutsText"];
|
12
12
|
var Datepicker = /*#__PURE__*/forwardRef(function Datepicker(props, ref) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Context.js","sources":["../../../../../src/components/Dialog/Context.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-function */\nimport * as React from 'react';\nimport { DialogSize } from './types';\n\nexport type DialogContext = {\n draggable: boolean;\n drawer?: {\n open: boolean;\n toggle: () => void;\n };\n elements: {\n drawer?: React.ReactNode;\n extra?: React.ReactNode;\n };\n close: () => void;\n onClose?: () => void;\n props: {};\n size: DialogSize;\n};\n\nexport const DialogContext = React.createContext<DialogContext>({\n close: () => {},\n draggable: false,\n drawer: undefined,\n elements: {\n drawer: undefined,\n extra: undefined,\n },\n onClose: () => {},\n props: {},\n size: 'sm',\n});\n\nexport const useCurrentDialog = () => {\n return React.useContext(DialogContext);\n};\n"],"names":["DialogContext","React","close","draggable","drawer","undefined","elements","extra","onClose","props","size","useCurrentDialog"],"mappings":";;AAAA;
|
1
|
+
{"version":3,"file":"Context.js","sources":["../../../../../src/components/Dialog/Context.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-function */\nimport * as React from 'react';\nimport { DialogSize } from './types';\n\nexport type DialogContext = {\n draggable: boolean;\n drawer?: {\n open: boolean;\n toggle: () => void;\n };\n elements: {\n drawer?: React.ReactNode;\n extra?: React.ReactNode;\n };\n close: () => void;\n onClose?: () => void;\n props: {};\n ref: React.Ref<HTMLElement>;\n size: DialogSize;\n};\n\nexport const DialogContext = React.createContext<DialogContext>({\n close: () => {},\n draggable: false,\n drawer: undefined,\n elements: {\n drawer: undefined,\n extra: undefined,\n },\n onClose: () => {},\n props: {},\n ref: null,\n size: 'sm',\n});\n\nexport const useCurrentDialog = () => {\n return React.useContext(DialogContext);\n};\n"],"names":["DialogContext","React","close","draggable","drawer","undefined","elements","extra","onClose","props","ref","size","useCurrentDialog"],"mappings":";;AAAA;IAqBaA,aAAa,gBAAGC,aAAA,CAAmC;AAC5DC,EAAAA,KAAK,EAAE,mBADqD;AAE5DC,EAAAA,SAAS,EAAE,KAFiD;AAG5DC,EAAAA,MAAM,EAAEC,SAHoD;AAI5DC,EAAAA,QAAQ,EAAE;AACNF,IAAAA,MAAM,EAAEC,SADF;AAENE,IAAAA,KAAK,EAAEF;AAFD,GAJkD;AAQ5DG,EAAAA,OAAO,EAAE,qBARmD;AAS5DC,EAAAA,KAAK,EAAE,EATqD;AAU5DC,EAAAA,GAAG,EAAE,IAVuD;AAW5DC,EAAAA,IAAI,EAAE;AAXsD,CAAnC;IAchBC,gBAAgB,GAAG,SAAnBA,gBAAmB;AAC5B,SAAOX,UAAA,CAAiBD,aAAjB,CAAP;AACH;;;;"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
2
|
-
import { useMemo, Children, useState, createElement } from 'react';
|
2
|
+
import { forwardRef, useMemo, Children, useState, createElement } from 'react';
|
3
3
|
import { Root } from '@radix-ui/react-dialog';
|
4
4
|
import { DialogContext } from './Context.js';
|
5
5
|
import { Trigger } from './components/Trigger.js';
|
@@ -27,7 +27,7 @@ var useSeparatedChildren = function useSeparatedChildren(initialChildren) {
|
|
27
27
|
}, [initialChildren]);
|
28
28
|
};
|
29
29
|
|
30
|
-
var Dialog = function
|
30
|
+
var Dialog = /*#__PURE__*/forwardRef(function (props, ref) {
|
31
31
|
var initialChildren = props.children,
|
32
32
|
_props$draggable = props.draggable,
|
33
33
|
draggable = _props$draggable === void 0 ? false : _props$draggable,
|
@@ -70,7 +70,8 @@ var Dialog = function Dialog(props) {
|
|
70
70
|
},
|
71
71
|
onClose: onClose,
|
72
72
|
props: otherProps,
|
73
|
-
size: size
|
73
|
+
size: size,
|
74
|
+
ref: ref
|
74
75
|
};
|
75
76
|
}, [open, drawerOpen, drawer, extra, otherProps]);
|
76
77
|
return createElement(DialogContext.Provider, {
|
@@ -80,7 +81,7 @@ var Dialog = function Dialog(props) {
|
|
80
81
|
open: open,
|
81
82
|
onOpenChange: setOpen
|
82
83
|
}));
|
83
|
-
};
|
84
|
+
});
|
84
85
|
Dialog.Trigger = Trigger;
|
85
86
|
Dialog.Content = Content;
|
86
87
|
Dialog.Title = Title;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Dialog.js","sources":["../../../../../src/components/Dialog/Dialog.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport './Dialog.css';\nimport { Trigger } from './components/Trigger';\nimport {
|
1
|
+
{"version":3,"file":"Dialog.js","sources":["../../../../../src/components/Dialog/Dialog.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport './Dialog.css';\nimport { DialogTriggerProps, Trigger } from './components/Trigger';\nimport {\n Content,\n Title,\n Footer,\n Close,\n DialogContentProps,\n DialogTitleProps,\n DialogFooterProps,\n DialogCloseProps,\n} from './components/Content';\nimport { DialogDrawerProps, Drawer } from './components/Drawer';\nimport { DialogExtraProps, Extra } from './components/Extra';\nimport { DialogContext } from './Context';\nimport { DialogSize } from './types';\n\nexport { DialogContentProps, DialogTitleProps, DialogFooterProps, DialogCloseProps };\n\nexport type DialogTexts = {\n /**\n * Aria-label for close icon button in dialog.\n * To read more about how to provide the text, see [Provider](component:provider) component\n */\n close: string;\n drag: string;\n};\n\nexport type DialogProps = {\n children: React.ReactNode | React.ReactNode[];\n /** Allows dragging the dialog around the screen (window constrained) */\n draggable?: boolean;\n /** Handler called when dialog closes by user interaction */\n onClose?: () => void;\n /** Set whether the dialog is open by default or not, use when not providing a trigger */\n open?: boolean;\n /** Size of the dialog. This is the recommended way to set a size for dialog component. */\n size?: DialogSize;\n};\n\nconst useSeparatedChildren = initialChildren => {\n return React.useMemo(() => {\n const children: any[] = [];\n let drawer;\n let extra;\n\n React.Children.forEach(initialChildren, (child: any) => {\n if (child.type.displayName === 'Drawer') {\n drawer = child;\n } else if (child.type.displayName === 'Extra') {\n extra = child;\n } else {\n children.push(child);\n }\n });\n\n return [children, drawer, extra];\n }, [initialChildren]);\n};\n\nexport type ForwardedDialogWithStatics = React.ForwardRefExoticComponent<DialogProps & React.RefAttributes<HTMLElement>> & {\n Trigger: React.ForwardRefExoticComponent<DialogTriggerProps>;\n Content: React.ForwardRefExoticComponent<DialogContentProps>;\n Title: React.ForwardRefExoticComponent<DialogTitleProps>;\n Footer: React.ForwardRefExoticComponent<DialogFooterProps>;\n Extra: React.ForwardRefExoticComponent<DialogExtraProps>;\n Drawer: React.ForwardRefExoticComponent<DialogDrawerProps>;\n Close: React.ForwardRefExoticComponent<DialogCloseProps>;\n};\n\nexport const Dialog = React.forwardRef((props: DialogProps, ref: React.Ref<HTMLElement>): JSX.Element => {\n const { children: initialChildren, draggable = false, onClose, open: defaultOpen, size = 'sm', ...otherProps } = props;\n const [children, drawer, extra] = useSeparatedChildren(initialChildren);\n\n const [open, setOpen] = React.useState(defaultOpen);\n const [drawerOpen, setDrawerOpen] = React.useState(false);\n\n const context = React.useMemo(\n () => ({\n close: () => setOpen(false),\n draggable,\n drawer: {\n open: drawerOpen,\n toggle: () => setDrawerOpen(isDrawerOpen => !isDrawerOpen),\n },\n elements: {\n drawer,\n extra,\n },\n onClose,\n props: otherProps,\n size,\n ref,\n }),\n [open, drawerOpen, drawer, extra, otherProps]\n );\n\n return (\n <DialogContext.Provider value={context}>\n <DialogPrimitive.Root children={children} open={open} onOpenChange={setOpen} />\n </DialogContext.Provider>\n );\n}) as ForwardedDialogWithStatics;\n\nDialog.Trigger = Trigger;\nDialog.Content = Content;\nDialog.Title = Title;\nDialog.Footer = Footer;\nDialog.Extra = Extra;\nDialog.Drawer = Drawer;\nDialog.Close = Close;\n"],"names":["useSeparatedChildren","initialChildren","React","children","drawer","extra","forEach","child","type","displayName","push","Dialog","props","ref","draggable","onClose","defaultOpen","open","size","otherProps","setOpen","drawerOpen","setDrawerOpen","context","close","toggle","isDrawerOpen","elements","DialogContext","Provider","value","DialogPrimitive","onOpenChange","Trigger","Content","Title","Footer","Extra","Drawer","Close"],"mappings":"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"}
|
@@ -1,14 +1,14 @@
|
|
1
1
|
import { extends as _extends } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
|
2
2
|
import { forwardRef, createElement } from 'react';
|
3
3
|
import cn from 'classnames';
|
4
|
-
import { IconButton } from '../../IconButton/IconButton.js';
|
5
4
|
import { useLocalization } from '../../Provider/Provider.js';
|
6
|
-
import { useProxiedRef } from '../../../utils/hooks/useProxiedRef.js';
|
7
5
|
import { Title as Title$1, Close as Close$1, Portal, Overlay, Content as Content$1 } from '@radix-ui/react-dialog';
|
8
6
|
import { useCurrentDialog } from '../Context.js';
|
7
|
+
import { useProxiedRef } from '../../../utils/hooks/useProxiedRef.js';
|
9
8
|
import { useDraggable } from '../../../utils/hooks/useDraggable.js';
|
10
9
|
import { useCurrentMenu } from '../../Menu/Context.js';
|
11
10
|
import { Group } from '../../Group/Group.js';
|
11
|
+
import { IconButton } from '../../IconButton/IconButton.js';
|
12
12
|
|
13
13
|
var Title = /*#__PURE__*/forwardRef(function DialogTitle(props, ref) {
|
14
14
|
return createElement(Title$1, Object.assign({}, props, {
|
@@ -18,7 +18,7 @@ var Title = /*#__PURE__*/forwardRef(function DialogTitle(props, ref) {
|
|
18
18
|
});
|
19
19
|
var Footer = /*#__PURE__*/forwardRef(function DialogFooter(props, ref) {
|
20
20
|
return createElement("div", Object.assign({}, props, {
|
21
|
-
className: "flex justify-end
|
21
|
+
className: "mt-8 flex justify-end",
|
22
22
|
ref: ref
|
23
23
|
}), createElement(Group, null, props.children));
|
24
24
|
});
|
@@ -53,7 +53,7 @@ var Content = /*#__PURE__*/forwardRef(function DialogContent(props, ref) {
|
|
53
53
|
};
|
54
54
|
}
|
55
55
|
|
56
|
-
var className = cn('bg-white rounded
|
56
|
+
var className = cn('bg-white rounded mt-16 mx-auto', {
|
57
57
|
'w-128 text-center justify-center': dialog.size === 'dialog',
|
58
58
|
'w-xs': dialog.size === 'xs',
|
59
59
|
'w-sm': dialog.size === 'sm',
|
@@ -97,7 +97,7 @@ var Content = /*#__PURE__*/forwardRef(function DialogContent(props, ref) {
|
|
97
97
|
className: containerClassName
|
98
98
|
}, output, dialog.draggable && createElement("div", Object.assign({}, dragHandleProps, {
|
99
99
|
"aria-label": texts.dialog.drag,
|
100
|
-
className: "yt-dialog__drag absolute-center-x
|
100
|
+
className: "yt-dialog__drag absolute-center-x bg-grey-light top-1.5 h-3 w-24 cursor-move rounded text-center"
|
101
101
|
})), createElement(Close$1, {
|
102
102
|
asChild: true,
|
103
103
|
onClick: dialog.onClose
|