@octanejs/radix 0.1.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/LICENSE +21 -0
- package/README.md +100 -0
- package/package.json +45 -0
- package/src/AccessibleIcon.ts +26 -0
- package/src/Accordion.ts +282 -0
- package/src/AlertDialog.ts +110 -0
- package/src/Arrow.ts +21 -0
- package/src/AspectRatio.ts +34 -0
- package/src/Avatar.ts +152 -0
- package/src/Checkbox.ts +325 -0
- package/src/Collapsible.ts +170 -0
- package/src/ContextMenu.ts +303 -0
- package/src/Dialog.ts +308 -0
- package/src/DismissableLayer.ts +413 -0
- package/src/DropdownMenu.ts +275 -0
- package/src/FocusScope.ts +266 -0
- package/src/Form.ts +621 -0
- package/src/HoverCard.ts +318 -0
- package/src/Label.ts +25 -0
- package/src/Menu.ts +1057 -0
- package/src/Menubar.ts +572 -0
- package/src/NavigationMenu.ts +1236 -0
- package/src/OneTimePasswordField.ts +977 -0
- package/src/PasswordToggleField.ts +495 -0
- package/src/Popover.ts +354 -0
- package/src/Popper.ts +401 -0
- package/src/Portal.ts +19 -0
- package/src/Presence.ts +225 -0
- package/src/Primitive.ts +53 -0
- package/src/Progress.ts +92 -0
- package/src/Radio.ts +262 -0
- package/src/RadioGroup.ts +212 -0
- package/src/RovingFocusGroup.ts +259 -0
- package/src/ScrollArea.ts +966 -0
- package/src/Select.ts +1901 -0
- package/src/Separator.ts +36 -0
- package/src/Slider.ts +745 -0
- package/src/Slot.ts +105 -0
- package/src/Switch.ts +278 -0
- package/src/Tabs.ts +177 -0
- package/src/Toast.ts +923 -0
- package/src/Toggle.ts +31 -0
- package/src/ToggleGroup.ts +157 -0
- package/src/Toolbar.ts +130 -0
- package/src/Tooltip.ts +669 -0
- package/src/VisuallyHidden.ts +29 -0
- package/src/collection.ts +97 -0
- package/src/compose-event-handlers.ts +15 -0
- package/src/compose-refs.ts +53 -0
- package/src/context.ts +109 -0
- package/src/direction.ts +19 -0
- package/src/focus-guards.ts +56 -0
- package/src/index.ts +54 -0
- package/src/internal.ts +42 -0
- package/src/scroll-lock.ts +57 -0
- package/src/use-callback-ref.ts +28 -0
- package/src/use-effect-event.ts +36 -0
- package/src/use-is-hydrated.ts +23 -0
- package/src/use-previous.ts +28 -0
- package/src/use-size.ts +57 -0
- package/src/useControllableState.ts +78 -0
- package/src/useId.ts +15 -0
package/src/Separator.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Ported from @radix-ui/react-separator. A visual/semantic separator. `decorative` makes
|
|
2
|
+
// it presentational (role="none"); otherwise it's a `role="separator"` with an
|
|
3
|
+
// `aria-orientation` for the vertical case. `.ts` component via createElement.
|
|
4
|
+
import { createElement } from 'octane';
|
|
5
|
+
|
|
6
|
+
import { Primitive } from './Primitive';
|
|
7
|
+
|
|
8
|
+
const DEFAULT_ORIENTATION = 'horizontal';
|
|
9
|
+
const ORIENTATIONS = ['horizontal', 'vertical'] as const;
|
|
10
|
+
|
|
11
|
+
type Orientation = (typeof ORIENTATIONS)[number];
|
|
12
|
+
|
|
13
|
+
function isValidOrientation(orientation: any): orientation is Orientation {
|
|
14
|
+
return ORIENTATIONS.includes(orientation);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function Separator(props: any): any {
|
|
18
|
+
const {
|
|
19
|
+
decorative,
|
|
20
|
+
orientation: orientationProp = DEFAULT_ORIENTATION,
|
|
21
|
+
...domProps
|
|
22
|
+
} = props ?? {};
|
|
23
|
+
const orientation = isValidOrientation(orientationProp) ? orientationProp : DEFAULT_ORIENTATION;
|
|
24
|
+
// `aria-orientation` defaults to horizontal, so only set it for vertical.
|
|
25
|
+
const ariaOrientation = orientation === 'vertical' ? orientation : undefined;
|
|
26
|
+
const semanticProps = decorative
|
|
27
|
+
? { role: 'none' }
|
|
28
|
+
: { 'aria-orientation': ariaOrientation, role: 'separator' };
|
|
29
|
+
return createElement(Primitive.div, {
|
|
30
|
+
'data-orientation': orientation,
|
|
31
|
+
...semanticProps,
|
|
32
|
+
...domProps,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { Separator as Root };
|