|
17 | 17 | <script setup lang="ts"> |
18 | 18 | import type { PropType } from 'vue' |
19 | 19 | import MdIconButton from '../../md/MdIconButton.vue' |
| 20 | +import MdListItem from '../../md/MdListItem.vue' |
20 | 21 | import SegmentedControl from '../../tokens/SegmentedControl.vue' |
21 | 22 | import SegmentedOption from '../../tokens/SegmentedOption.vue' |
22 | 23 | import type { NodeEntry } from './permissionNodesApi' |
@@ -60,74 +61,80 @@ const emit = defineEmits(['toggle', 'remove']) |
60 | 61 | </script> |
61 | 62 |
|
62 | 63 | <template> |
63 | | - <div |
64 | | - class="flex flex-wrap items-center gap-x-4 gap-y-2 px-4 py-2 focus:outline-none" |
| 64 | + <MdListItem |
| 65 | + :lines="1" |
| 66 | + class="focus:outline-none" |
65 | 67 | tabindex="-1" |
66 | 68 | :class="highlighted ? 'animate-md-node-highlight motion-reduce:animate-none' : ''" |
67 | 69 | :data-node="entry.node" |
68 | 70 | :data-allowed="entry.allowed ? 'true' : 'false'" |
69 | 71 | :data-highlighted="highlighted ? 'true' : undefined" |
70 | | - data-ingot-component="node-row" |
71 | 72 | > |
72 | | - <div class="flex min-w-0 flex-1 flex-wrap items-center gap-2 basis-56"> |
73 | | - <code |
74 | | - class="break-all md-code-medium text-on-surface" |
75 | | - :title="entry.node" |
76 | | - >{{ label || entry.node }}</code> |
77 | | - <span |
78 | | - v-if="wildcardHint" |
79 | | - class="rounded-corner-small bg-secondary-container px-2 py-0.5 md-label-medium text-on-secondary-container" |
80 | | - data-test="wildcard-hint" |
81 | | - >all below</span> |
82 | | - <p |
83 | | - v-if="error" |
84 | | - data-ingot-state="error" |
85 | | - class="md-body-small text-error" |
86 | | - data-test="row-error" |
87 | | - > |
88 | | - {{ error }} |
89 | | - </p> |
90 | | - </div> |
91 | | - <span |
92 | | - v-if="readonly" |
93 | | - class="md-label-large" |
94 | | - :class="entry.allowed ? 'text-on-surface' : 'text-error'" |
95 | | - data-test="row-state" |
96 | | - >{{ entry.allowed ? 'Allowed' : 'Denied' }}</span> |
97 | | - <template v-else> |
98 | | - <div class="w-44 shrink-0"> |
99 | | - <SegmentedControl :label="`Access for ${entry.node}`"> |
100 | | - <SegmentedOption |
101 | | - :on="entry.allowed" |
102 | | - @click="emit('toggle', true)" |
103 | | - > |
104 | | - Allow |
105 | | - </SegmentedOption> |
106 | | - <SegmentedOption |
107 | | - :on="!entry.allowed" |
108 | | - @click="emit('toggle', false)" |
109 | | - > |
110 | | - Deny |
111 | | - </SegmentedOption> |
112 | | - </SegmentedControl> |
| 73 | + <div |
| 74 | + class="flex flex-wrap items-center gap-x-4 gap-y-2" |
| 75 | + data-ingot-component="node-row" |
| 76 | + > |
| 77 | + <div class="flex min-w-0 flex-1 flex-wrap items-center gap-2 basis-56"> |
| 78 | + <code |
| 79 | + class="break-all md-code-medium text-on-surface" |
| 80 | + :title="entry.node" |
| 81 | + >{{ label || entry.node }}</code> |
| 82 | + <span |
| 83 | + v-if="wildcardHint" |
| 84 | + class="rounded-corner-small bg-secondary-container px-2 py-0.5 md-label-medium text-on-secondary-container" |
| 85 | + data-test="wildcard-hint" |
| 86 | + >all below</span> |
| 87 | + <p |
| 88 | + v-if="error" |
| 89 | + data-ingot-state="error" |
| 90 | + class="md-body-small text-error" |
| 91 | + data-test="row-error" |
| 92 | + > |
| 93 | + {{ error }} |
| 94 | + </p> |
113 | 95 | </div> |
114 | | - <MdIconButton |
115 | | - variant="error" |
116 | | - :aria-label="`Remove ${entry.node}`" |
117 | | - data-test="remove-node" |
118 | | - @click="emit('remove')" |
119 | | - > |
120 | | - <svg |
121 | | - viewBox="0 -960 960 960" |
122 | | - aria-hidden="true" |
123 | | - focusable="false" |
| 96 | + <span |
| 97 | + v-if="readonly" |
| 98 | + class="md-label-large" |
| 99 | + :class="entry.allowed ? 'text-on-surface' : 'text-error'" |
| 100 | + data-test="row-state" |
| 101 | + >{{ entry.allowed ? 'Allowed' : 'Denied' }}</span> |
| 102 | + <template v-else> |
| 103 | + <div class="w-44 shrink-0"> |
| 104 | + <SegmentedControl :label="`Access for ${entry.node}`"> |
| 105 | + <SegmentedOption |
| 106 | + :on="entry.allowed" |
| 107 | + @click="emit('toggle', true)" |
| 108 | + > |
| 109 | + Allow |
| 110 | + </SegmentedOption> |
| 111 | + <SegmentedOption |
| 112 | + :on="!entry.allowed" |
| 113 | + @click="emit('toggle', false)" |
| 114 | + > |
| 115 | + Deny |
| 116 | + </SegmentedOption> |
| 117 | + </SegmentedControl> |
| 118 | + </div> |
| 119 | + <MdIconButton |
| 120 | + variant="error" |
| 121 | + :aria-label="`Remove ${entry.node}`" |
| 122 | + data-test="remove-node" |
| 123 | + @click="emit('remove')" |
124 | 124 | > |
125 | | - <path |
126 | | - fill="currentColor" |
127 | | - d="M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z" |
128 | | - /> |
129 | | - </svg> |
130 | | - </MdIconButton> |
131 | | - </template> |
132 | | - </div> |
| 125 | + <svg |
| 126 | + viewBox="0 -960 960 960" |
| 127 | + aria-hidden="true" |
| 128 | + focusable="false" |
| 129 | + > |
| 130 | + <path |
| 131 | + fill="currentColor" |
| 132 | + d="M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z" |
| 133 | + /> |
| 134 | + </svg> |
| 135 | + </MdIconButton> |
| 136 | + </template> |
| 137 | + |
| 138 | + </div> |
| 139 | + </MdListItem> |
133 | 140 | </template> |
0 commit comments