Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
688 changes: 158 additions & 530 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@
"escape-html": "^1.0.3",
"lit": "^3.3.3",
"mime-types": "^3.0.2",
"pane-registry": "5.1.2-0",
"pane-registry": "5.1.3-0",
"rdflib": "2.4.1",
"solid-logic": "6.2.1-0",
"solid-logic": "6.2.2-0",
"solid-namespace": "^0.5.4",
"uuid": "^14.0.0"
},
Expand Down
8 changes: 4 additions & 4 deletions src/acl/access-groups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ const ACL = ns.acl

const COLLOQUIAL = {
13: 'Owners',
9: 'Owners (write locked)',
9: 'Admins',
5: 'Editors',
3: 'Posters',
2: 'Submitters',
3: 'Commenters',
2: 'Appenders',
1: 'Viewers'
}

Expand Down Expand Up @@ -50,7 +50,7 @@ export interface AccessGroupsOptions {
}

/**
* Renders the table of Owners, Editors, Posters, Submitters, Viewers
* Renders the table of Owners, Admins, Editors, Commenters, Appenders, Viewers
* for https://github.com/solidos/userguide/blob/main/views/sharing/userguide.md
*/
export class AccessGroups {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,65 @@
line-height: 1.5;
}

.access-grants-form-main {
.access-grants-form-heading {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
width: 100%;
}

.access-control-advanced-toggle {
display: inline-flex;
align-items: center;
gap: 8px;
flex: 0 0 auto;
min-height: 42px;
padding: 8px 0;
border: 0;
background: transparent;
color: var(--solid-ui-color-gray-600, #4A5565);
cursor: pointer;
font: inherit;

&:focus-visible {
outline: var(--focus-indicator-width, 2px) solid var(--solid-ui-color-primary, #7C4DFF);
outline-offset: 2px;
}
}

.access-control-switch-track {
display: inline-flex;
align-items: center;
width: 28px;
height: 16px;
padding: 2px;
border-radius: 999px;
background: var(--solid-ui-color-gray-300, #D1D5DC);
transition: background-color 120ms ease;
}

.access-control-switch-thumb {
width: 12px;
height: 12px;
border-radius: 50%;
background: var(--solid-ui-color-white, #FFF);
transition: transform 120ms ease;
}

.access-control-advanced-toggle[aria-checked='true'] {
.access-control-switch-track {
background: var(--solid-ui-color-primary, #6D28D9);
}

.access-control-switch-thumb {
transform: translateX(12px);
}
}

.access-grants-form-main {
display: flex;
align-items: flex-start;
gap: 10px;
align-self: stretch;

Expand All @@ -36,6 +92,7 @@
solid-ui-combobox {
width: 100%;
--solid-ui-input-border-color: var(--solid-ui-color-slate-200, #E2E8F0);
--solid-ui-combobox-option-icon-size: 13px;
}

.access-principal-error {
Expand Down Expand Up @@ -95,12 +152,7 @@
}
}

.access-grants-directory-entry {
display: inline-flex;
align-items: center;
gap: 8px;
line-height: 1;
}


.access-role-select {
display: block;
Expand All @@ -114,4 +166,5 @@
.access-role-select--top {
margin-top: 0;
}

}
87 changes: 64 additions & 23 deletions src/components/access-control-modal/AccessControlAddAccess.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { customElement, WebComponent } from '@/lib/components'
import { html, nothing } from 'lit'
import { property } from 'lit/decorators.js'
import { html, nothing, type PropertyValues } from 'lit'
import { property, query } from 'lit/decorators.js'
import { ACCESS_ROLES, type AccessRole, type DirectoryEntry } from 'solid-logic'
import type { AsyncComboboxOptionsProvider, ComboboxChangeEvent, ComboboxOptionData } from '@/components/combobox'

Expand All @@ -14,31 +14,22 @@ import '@/components/combobox'
import '@/components/combobox-option'

import styles from './AccessControlAddAccess.styles.css'
import type { PendingAccessGrant, PendingGrantRemovedDetail, RoleChangedDetail, TargetInputDetail, TargetSelectedDetail } from './types'

export function directoryEntryOptionTemplate (entry: DirectoryEntry) {
return html`
<span class="access-grants-directory-entry">
${renderDirectoryEntryIcon(entry)}
<span>${entry.label}</span>
</span>
`
}
import type { AdvancedSharingChangedDetail, PendingAccessGrant, PendingGrantRemovedDetail, RoleChangedDetail, TargetInputDetail, TargetSelectedDetail } from './types'

function renderDirectoryEntryIcon (entry: DirectoryEntry) {
export function directoryEntryOptionIcon (entry: DirectoryEntry) {
if (entry.sources.includes('contacts') || entry.sources.includes('groups')) {
return html`<icon-lucide-book-user style="width: 13px; height: 13px; flex: 0 0 13px;"></icon-lucide-book-user>`
return html`<icon-lucide-book-user></icon-lucide-book-user>`
}

if (entry.sources.includes('friends')) {
return html`<icon-lucide-users style="width: 13px; height: 13px; flex: 0 0 13px;"></icon-lucide-users>`
return html`<icon-lucide-users></icon-lucide-users>`
}

if (entry.sources.includes('catalog')) {
return html`<icon-lucide-user-round style="width: 13px; height: 13px; flex: 0 0 13px;"></icon-lucide-user-round>`
return html`<icon-lucide-user-round></icon-lucide-user-round>`
}

return nothing
return undefined
}

@customElement('solid-ui-access-control-add-access')
Expand All @@ -49,7 +40,7 @@ export default class AccessControlAddAccess extends WebComponent {
accessor principalInputValue = ''

@property({ attribute: false })
accessor addAccessRoleValue: AccessRole = 'Viewer'
accessor addAccessRoleValue: AccessRole = 'No Access'

@property({ attribute: false })
accessor pendingAccessGrants: PendingAccessGrant[] = []
Expand All @@ -63,6 +54,32 @@ export default class AccessControlAddAccess extends WebComponent {
@property({ attribute: false })
accessor asyncOptionsProvider: AsyncComboboxOptionsProvider | null = null

@property({ type: Boolean })
accessor showAdvancedToggle = false

@property({ type: Boolean })
accessor advancedSharingOpen = false

@query('.access-role-select--top')
private accessor roleCombobox: HTMLElement & { value?: string } | null = null

protected updated (changedProperties: PropertyValues<this>) {
super.updated(changedProperties)

const roleCombobox = this.roleCombobox
if (changedProperties.has('addAccessRoleValue') && roleCombobox && roleCombobox.value !== this.addAccessRoleValue) {
roleCombobox.value = this.addAccessRoleValue
}
}

private onAdvancedSharingToggle () {
this.dispatchEvent(new CustomEvent<AdvancedSharingChangedDetail>('advanced-sharing-changed', {
detail: { open: !this.advancedSharingOpen },
bubbles: true,
composed: true
}))
}

private onPrincipalInput (event: Event) {
const value = this.getEventValue(event)
this.dispatchEvent(new CustomEvent<TargetInputDetail>('target-input', {
Expand Down Expand Up @@ -103,6 +120,12 @@ export default class AccessControlAddAccess extends WebComponent {
bubbles: true,
composed: true
}))

if (this.roleCombobox) {
this.roleCombobox.value = 'No Access'
const input = this.roleCombobox.shadowRoot?.querySelector<HTMLInputElement>('input')
if (input) input.value = 'No Access'
}
}

private onPendingGrantRemove (index: number) {
Expand All @@ -121,7 +144,25 @@ export default class AccessControlAddAccess extends WebComponent {
protected render () {
return html`
<section class="access-grants-form" aria-label="Add access">
<p>Add person, group or software agent URL.</p>
<div class="access-grants-form-heading">
<p>Add person, group or software agent URL.</p>
${this.showAdvancedToggle
? html`
<button
type="button"
class="access-control-advanced-toggle"
role="switch"
aria-checked=${this.advancedSharingOpen ? 'true' : 'false'}
@click=${this.onAdvancedSharingToggle}
>
<span class="access-control-switch-track" aria-hidden="true">
<span class="access-control-switch-thumb"></span>
</span>
<span>Advanced</span>
</button>
`
: nothing}
</div>
<div class="access-grants-form-main">
<div class="access-grants-input">
<solid-ui-combobox
Expand All @@ -142,13 +183,13 @@ export default class AccessControlAddAccess extends WebComponent {
</div>
<solid-ui-combobox
class="access-role-select access-role-select--top"
.disabled=${this.disabled}
label="Access role for added people"
.srOnlyLabel=${true}
.disabled=${this.disabled || !this.pendingAccessGrants.length}
.value=${this.addAccessRoleValue}
@change=${this.onRoleChange}
>
${ACCESS_ROLES
.filter(role => role !== 'No Access')
.map(role => html`
${ACCESS_ROLES.map(role => html`
<solid-ui-combobox-option value=${role}>${role}</solid-ui-combobox-option>
`)}
</solid-ui-combobox>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ export default class AccessControlGeneralAccess extends WebComponent {
return html`
<solid-ui-combobox
class="access-role-select access-role-select--compact access-role-select--general access-grants-role access-grants-role--editable access-role-select--authenticated"
label="Access role for logged-in users"
.srOnlyLabel=${true}
.disabled=${this.disabled}
.value=${this.authenticatedAccessRoleValue}
@change=${this.onAuthenticatedRoleChange}
Expand All @@ -99,6 +101,8 @@ export default class AccessControlGeneralAccess extends WebComponent {
return html`
<solid-ui-combobox
class="access-role-select access-role-select--compact access-role-select--general access-grants-role access-grants-role--editable access-role-select--public"
label="Access role for anyone with the link"
.srOnlyLabel=${true}
.disabled=${this.disabled}
.value=${this.publicAccessRoleValue}
@change=${this.onPublicRoleChange}
Expand Down
Loading
Loading